#

Note

This documents the development version of NetworkX. Documentation for the current release can be found here.

#

networkx.convert.to_dict_of_dicts

to_dict_of_dicts(G, nodelist=None, edge_data=None)[source]

Returns adjacency representation of graph as a dictionary of dictionaries.

Parameters
  • G (graph) – A NetworkX graph

  • nodelist (list) – Use only nodes specified in nodelist

  • edge_data (list, optional) – If provided, the value of the dictionary will be set to edge_data for all edges. This is useful to make an adjacency matrix type representation with 1 as the edge data. If edgedata is None, the edgedata in G is used to fill the values. If G is a multigraph, the edgedata is a dict for each pair (u,v).