-
Notifications
You must be signed in to change notification settings - Fork 133
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
Add is_bipartite(::Graph)
#4499
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #4499 +/- ##
=======================================
Coverage 84.55% 84.55%
=======================================
Files 672 672
Lines 88888 88890 +2
=======================================
+ Hits 75157 75160 +3
+ Misses 13731 13730 -1
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few suggestions, and please add the function to docs/src/Combinatorics/graphs.md
.
function is_bipartite(g::Graph{T}) where T | ||
return Polymake.graph.Graph{T}(ADJACENCY=g.pm_graph).BIPARTITE::Bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function is_bipartite(g::Graph{T}) where T | |
return Polymake.graph.Graph{T}(ADJACENCY=g.pm_graph).BIPARTITE::Bool | |
function is_bipartite(g::Graph{Undirected}) | |
return Polymake.graph.Graph{Undirected}(ADJACENCY=pm_object(g)).BIPARTITE::Bool |
This is only defined for undirected graphs.
graph/objects/Combinatorics/Graph/properties/BIPARTITE:
property BIPARTITE : Bool
Only defined for Graph<Undirected>.
True if the graph is a bipartite.
# Examples | ||
``` | ||
julia> g = graph_from_edges([1,2],[2,3],[3,4]]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
julia> g = graph_from_edges([1,2],[2,3],[3,4]]); | |
julia> g = graph_from_edges([[1,2],[2,3],[3,4]]); |
``` | ||
julia> g = graph_from_edges([1,2],[2,3],[3,4]]); | ||
julia> is_bipartite(G) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
julia> is_bipartite(G) | |
julia> is_bipartite(g) |
@@ -1339,3 +1339,20 @@ function laplacian_matrix(g::Graph) | |||
A = matrix(ZZ, adjacency_matrix(g)) | |||
return D-A | |||
end | |||
|
|||
@doc raw""" | |||
is_bipartite(g::Graph) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is_bipartite(g::Graph) | |
is_bipartite(g::Graph{Undirected}) |
@doc raw""" | ||
is_bipartite(g::Graph) | ||
Returns true if the graph `g` is bipartite. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returns true if the graph `g` is bipartite. | |
Returns true if the undirected graph `g` is bipartite. |
Returns true if the graph `g` is bipartite. | ||
# Examples | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
``` | |
```jldoctest |
The title says it all.