from_dict_of_dicts

from_dict_of_dicts(d, create_using=None, multigraph_input=False)[source]

Returns a graph from a dictionary of dictionaries.

Parameters
ddictionary of dictionaries

A dictionary of dictionaries adjacency representation.

create_usingNetworkX graph constructor, optional (default=nx.Graph)

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

multigraph_inputbool (default False)

When True, the dict d is assumed to be a dict-of-dict-of-dict-of-dict structure keyed by node to neighbor to edge keys to edge data for multi-edges. Otherwise this routine assumes dict-of-dict-of-dict keyed by node to neighbor to edge data.

Examples

>>> dod = {0: {1: {"weight": 1}}}  # single edge (0,1)
>>> G = nx.from_dict_of_dicts(dod)

or

>>> G = nx.Graph(dod)  # use Graph constructor