Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
sbromberger committed Oct 25, 2015
1 parent 2ff0e64 commit c1b9a98
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/traversals/bfs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -270,4 +270,7 @@ function is_bipartite(g::SimpleGraph, s::Int)
return visitor.is_bipartite
end

is_bipartite(g::SimpleGraph) = all(x->is_bipartite(g,x), vertices(g))
function is_bipartite(g::SimpleGraph)
cc = filter(x->length(x)>2, connected_components(g))
return all(x->is_bipartite(g,x[1]), cc)
end

0 comments on commit c1b9a98

Please sign in to comment.