bipartite_layout(G, nodes, align='vertical', scale=1, center=None, aspect_ratio=1.3333333333333333)
This algorithm currently only works in two dimensions and does not try to minimize edge crossings.
A position will be assigned to every node in G.
Nodes in one node set of the bipartite graph. This set will be placed on left or top.
The alignment of nodes. Vertical or horizontal.
Scale factor for positions.
Coordinate pair around which to center the layout.
The ratio of the width to the height of the layout.
A dictionary of positions keyed by node.
Position nodes in two straight lines.
>>> G = nx.bipartite.gnmk_random_graph(3, 5, 10, seed=123)See :
... top = nx.bipartite.sets(G)[0]
... pos = nx.bipartite_layout(G, top)
The following pages refer to to this document either explicitly or contain code examples using this.
networkx.drawing.layout.bipartite_layout
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them