Closed cjoshea9 closed 7 years ago
Just to be a bit quicker for the bipartite graphs,
def bipartite_number(g):
"""
Defined as the largest number of vertices that induces a bipartite subgraph
sage: bn(graphs.PetersenGraph())
7
sage: bn(c4)
4
sage: bn(graphs.CompleteGraph(3))
2
"""
if g.is_bipartite():
return g.order()
return len(bs(g, [], g.vertices()))