Warning
This documents an unmaintained version of NetworkX. Please upgrade to a maintained version and see the current NetworkX documentation.
adjacency_graph¶
-
adjacency_graph
(data, directed=False, multigraph=True, attrs={'id': 'id', 'key': 'key'})[source]¶ Return graph from adjacency data format.
Parameters: data : dict
Adjacency list formatted graph data
Returns: G : NetworkX graph
A NetworkX graph object
directed : bool
If True, and direction not specified in data, return a directed graph.
multigraph : bool
If True, and multigraph not specified in data, return a multigraph.
attrs : dict
A dictionary that contains two keys ‘id’ and ‘key’. The corresponding values provide the attribute names for storing NetworkX-internal graph data. The values should be unique. Default value:
dict(id='id', key='key')
.See also
Notes
The default value of attrs will be changed in a future release of NetworkX.
Examples
>>> from networkx.readwrite import json_graph >>> G = nx.Graph([(1,2)]) >>> data = json_graph.adjacency_data(G) >>> H = json_graph.adjacency_graph(data)