NetworkX

Previous topic

networkx.convert.to_dict_of_lists

Next topic

networkx.convert.to_edgelist

networkx.convert.from_dict_of_lists

networkx.convert.from_dict_of_lists(d, create_using=None)

Return a graph from a dictionary of lists.

Parameters :

d : dictionary of lists

A dictionary of lists adjacency representation.

create_using : NetworkX graph

Use specified graph for result. Otherwise a new graph is created.

Examples

>>> dol= {0:[1]} # single edge (0,1)
>>> G=nx.from_dict_of_lists(dol)

or >>> G=nx.Graph(dol) # use Graph constructor