aryagraph.layout.bipartite#

aryagraph.layout.bipartite(g: Any, *, top: Iterable[Hashable] | None = None, align: str = 'vertical', seed: int = 0) → Layout[source]#

Two parallel lines of nodes, edges running between them.

Parameters:
  • top – Nodes of the first side. None 2-colours each component by BFS (for a non-bipartite graph this is a best-effort split).

  • align – "vertical" gives two columns side by side (first side on the left); "horizontal" gives two rows (first side on top).

Notes

Both sides are ordered by alternating barycenter sweeps (the best ordering seen is kept), which removes most crossings.