tree_graph#
- tree_graph(data, ident='id', children='children')[source]#
返回从树形数据格式转换的图。
- Parameters:
- datadict
树形格式的图数据
- identstring
用于存储NetworkX内部图数据的属性名称。
ident必须与children的值不同。默认值为’id’。- childrenstring
用于存储NetworkX内部图数据的属性名称。
children必须与ident的值不同。默认值为’children’。
- Returns:
- GNetworkX DiGraph
See also
Examples
>>> from networkx.readwrite import json_graph >>> G = nx.DiGraph([(1, 2)]) >>> data = json_graph.tree_data(G, root=1) >>> H = json_graph.tree_graph(data)