networkx 2.8.2 Pypi GitHub Homepage
Other Docs
NotesParametersReturnsBackRef
bipartite_layout(G, nodes, align='vertical', scale=1, center=None, aspect_ratio=1.3333333333333333)

Notes

This algorithm currently only works in two dimensions and does not try to minimize edge crossings.

Parameters

G : NetworkX graph or list of nodes

A position will be assigned to every node in G.

nodes : list or container

Nodes in one node set of the bipartite graph. This set will be placed on left or top.

align : string (default='vertical')

The alignment of nodes. Vertical or horizontal.

scale : number (default: 1)

Scale factor for positions.

center : array-like or None

Coordinate pair around which to center the layout.

aspect_ratio : number (default=4/3):

The ratio of the width to the height of the layout.

Returns

pos : dict

A dictionary of positions keyed by node.

Position nodes in two straight lines.

Examples

>>> G = nx.bipartite.gnmk_random_graph(3, 5, 10, seed=123)
... top = nx.bipartite.sets(G)[0]
... pos = nx.bipartite_layout(G, top)
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

networkx.drawing.layout.bipartite_layout

Local connectivity graph

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


GitHub : /networkx/drawing/layout.py#267
type: <class 'function'>
Commit: