kamada_kawai_layout(G, dist=None, pos=None, weight='weight', scale=1, center=None, dim=2)
A position will be assigned to every node in G.
A two-level dictionary of optimal distances between nodes, indexed by source and destination node. If None, the distance is computed using shortest_path_length().
Initial positions for nodes as a dictionary with node as keys and values as a coordinate list or tuple. If None, then use circular_layout() for dim >= 2 and a linear layout for dim == 1.
The edge attribute that holds the numerical value used for the edge weight. If None, then all edge weights are 1.
Scale factor for positions.
Coordinate pair around which to center the layout.
Dimension of layout.
A dictionary of positions keyed by node
Position nodes using Kamada-Kawai path-length cost-function.
>>> G = nx.path_graph(4)See :
... pos = nx.kamada_kawai_layout(G)
The following pages refer to to this document either explicitly or contain code examples using this.
networkx.drawing.nx_pylab.draw_kamada_kawai
networkx.drawing.layout.kamada_kawai_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