dynetx.readwrite.json_graph.node_link_graph¶
-
dynetx.readwrite.json_graph.
node_link_graph
(data, directed=False, attrs={'id': 'id', 'source': 'source', 'target': 'target'})¶ Return graph from node-link data format.
Parameters: - data (dict) – node-link formatted graph data
- directed (bool) – If True, and direction not specified in data, return a directed graph.
- attrs (dict) – A dictionary that contains three keys ‘id’, ‘source’, ‘target’.
The corresponding values provide the attribute names for storing
Dynetx-internal graph data. Default value:
dict(id='id', source='source', target='target')
.
Returns: G – A DyNetx graph object
Return type: DyNetx graph
Examples
>>> from dynetx.readwrite import json_graph >>> import dynetx as dn >>> G = dn.DynGraph([(1,2)]) >>> data = json_graph.node_link_data(G) >>> H = json_graph.node_link_graph(data)
See also