Warning

This documents an unmaintained version of NetworkX. Please upgrade to a maintained version and see the current NetworkX documentation.

to_dict_of_dicts

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

Return 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).