Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create isBipartiteGraph.hpp #465

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Conversation

THIRU-1074
Copy link

->ISSUE REFERENCE:

#464 (comment)

->DESCRIPTION:

Implemented a header file to check if the graph is biPartite or biColourable. The algorithm has its own cycle detection algorithm which counts the number of nodes in the cycle and checks for odd nodes cycle, which determines whether the undirected graph is biPartite.

->REVIEW MEMBER

@ZigRazor

@ZigRazor ZigRazor added the enhancement New feature or request label Sep 4, 2024
@ZigRazor ZigRazor added this to the Algorithm Implementation milestone Sep 4, 2024
@ZigRazor ZigRazor linked an issue Sep 4, 2024 that may be closed by this pull request
@sbaldu
Copy link
Collaborator

sbaldu commented Sep 6, 2024

Also, can you add a couple of tests please?

->Test for Bipartite Graph
->Test for Non-Bipartite Graph
->Test for Empty Graph
->Test for Single Node Graph
->Test for Complex Bipartite Graph
Copy link
Collaborator

@sbaldu sbaldu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One last thing, please clang-format both files. Thanks :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests are failing. You need to include this file in CXXGraph/include/Graph/Graph.h


CXXGraph::Graph<int> graph(edgeSet);

bool isBipartite = graph.isBipartite();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method doesn't exist, you didn't define it. Maybe you'd want to rename the methods in the header file.

Comment on lines +30 to +38
class Graph {
public:
TopoSortResult<T> checkOddNodesCycleDir() const;

private:
void checkOddNodesCycleUtil(std::vector<int>& visited,
std::vector<int>& chainNo, int root,
int cycleLength, bool& isBiPartite) const;
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can't re-declare the class here. Declare the methods in the Graph_decl.hpp file, possibly adding method descriptions like you see there, and in this file you only define them

@sbaldu
Copy link
Collaborator

sbaldu commented Sep 7, 2024

Also, check that the code compiles and runs before committing :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Header file to check if a Graph is Biparatite (Bi-colourable)
3 participants