Warning
This documents an unmaintained version of NetworkX. Please upgrade to a maintained version and see the current NetworkX documentation.
from_dict_of_dicts¶
- from_dict_of_dicts(d, create_using=None, multigraph_input=False)[source]¶
Return a graph from a dictionary of dictionaries.
Parameters : d : dictionary of dictionaries
A dictionary of dictionaries adjacency representation.
create_using : NetworkX graph
Use specified graph for result. Otherwise a new graph is created.
multigraph_input : bool (default False)
When True, the values of the inner dict are assumed to be containers of edge data for multiple edges. Otherwise this routine assumes the edge data are singletons.
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