aryagraph.algorithms.coloring.bipartite_sets#

aryagraph.algorithms.coloring.bipartite_sets(g: Graph) → tuple[set[Hashable], set[Hashable]][source]#

The two sides (top, bottom) of a bipartite graph.

Every component is 2-colored from its first node (in graph order), which goes to top, so disconnected graphs get a deterministic split where networkx refuses. Raises GraphTypeError, naming an odd cycle, when the graph is not bipartite.