networkx 2.8.2 Pypi GitHub Homepage
Other Docs
NotesParametersReturns
view_pygraphviz(G, edgelabel=None, prog='dot', args='', suffix='', path=None, show=True)

Notes

If this function is called in succession too quickly, sometimes the image is not displayed. So you might consider time.sleep(.5) between calls if you experience problems.

Parameters

G : NetworkX graph

The machine to draw.

edgelabel : str, callable, None

If a string, then it specifes the edge attribute to be displayed on the edge labels. If a callable, then it is called for each edge and it should return the string to be displayed on the edges. The function signature of :None:None:`edgelabel` should be edgelabel(data), where :None:None:`data` is the edge attribute dictionary.

prog : string

Name of Graphviz layout program.

args : str

Additional arguments to pass to the Graphviz layout program.

suffix : str

If :None:None:`filename` is None, we save to a temporary file. The value of :None:None:`suffix` will appear at the tail end of the temporary filename.

path : str, None

The filename used to save the image. If None, save to a temporary file. File formats are the same as those from pygraphviz.agraph.draw.

show : bool, default = True

Whether to display the graph with PIL.Image.show , default is :None:None:`True`. If :None:None:`False`, the rendered graph is still available at :None:None:`path`.

Returns

path : str

The filename of the generated image.

A : PyGraphviz graph

The PyGraphviz graph instance used to generate the image.

Views the graph G using the specified layout algorithm.

Examples

See :

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_agraph.py#304
type: <class 'function'>
Commit: