networkx 2.8.2 Pypi GitHub Homepage
Other Docs
ParametersBackRef
to_networkx_graph(data, create_using=None, multigraph_input=False)

The preferred way to call this is automatically from the class constructor

>>> d = {0: {1: {"weight": 1}}}  # dict-of-dicts single edge (0,1)
>>> G = nx.Graph(d)

instead of the equivalent

>>> G = nx.from_dict_of_dicts(d)

Parameters

data : object to be converted

Current known types are:

any NetworkX graph dict-of-dicts dict-of-lists container (e.g. set, list, tuple) of edges iterator (e.g. itertools.chain) that produces edges generator of edges Pandas DataFrame (row per edge) 2D numpy array scipy sparse matrix pygraphviz agraph

create_using : NetworkX graph constructor, optional (default=nx.Graph)

Graph type to create. If graph instance, then cleared before populated.

multigraph_input : bool (default False)

If True and data is a dict_of_dicts, try to create a multigraph assuming dict_of_dict_of_lists. If data and create_using are both multigraphs then create a multigraph from a multigraph.

Make a NetworkX graph from a known data structure.

Examples

See :

Back References

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

networkx.convert_matrix

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/convert.py#33
type: <class 'function'>
Commit: