networkx 2.8.2 Pypi GitHub Homepage
Other Docs
NotesParametersReturnsBackRef
pydot_layout(G, prog='neato', root=None)

Notes

If you use complex node objects, they may have the same string representation and GraphViz could treat them as the same node. The layout may assign both nodes a single location. See Issue #1568 If this occurs in your case, consider relabeling the nodes just for the layout computation using something similar to:

H = nx.convert_node_labels_to_integers(G, label_attribute='node_label')
H_layout = nx.nx_pydot.pydot_layout(G, prog='dot')
G_layout = {H.nodes[n]['node_label']: p for n, p in H_layout.items()}

Parameters

G : Graph

NetworkX graph to be laid out.

prog : string (default: 'neato')

Name of the GraphViz command to use for layout. Options depend on GraphViz version but may include: 'dot', 'twopi', 'fdp', 'sfdp', 'circo'

root : Node from G or None (default: None)

The node of G from which to start some layout algorithms.

Returns

dict

Dictionary of positions keyed by node.

Create node positions using pydot and Graphviz.

Examples

>>> G = nx.complete_graph(4)
... pos = nx.nx_pydot.pydot_layout(G)
... pos = nx.nx_pydot.pydot_layout(G, prog="dot")
See :

Back References

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

networkx.drawing.nx_pydot.pydot_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/nx_pydot.py#266
type: <class 'function'>
Commit: