File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -60,13 +60,14 @@ def _fill_from_layer(G_out, layer):
6060 G_out .add_edge (edge .source , edge .target , ** _convert_attr (edge .info ))
6161
6262
63- def graph_to_networkx (G_in , include_dynamic = True ):
63+ def graph_to_networkx (G_in , include_dynamic = True , directed = False ):
6464 """Convert the DSG to a networkx representation."""
6565 nx = _get_networkx ()
6666 if nx is None :
6767 return None
6868
69- G_out = nx .Graph ()
69+ G_out = nx .DiGraph () if directed else nx .Graph ()
70+
7071 for layer in G_in .layers :
7172 _fill_from_layer (G_out , layer )
7273
@@ -85,12 +86,13 @@ def graph_to_networkx(G_in, include_dynamic=True):
8586 return G_out
8687
8788
88- def layer_to_networkx (G_in ):
89+ def layer_to_networkx (G_in , directed = False ):
8990 """Convert the DSG to a networkx representation."""
9091 nx = _get_networkx ()
9192 if nx is None :
9293 return None
9394
94- G_out = nx .Graph ()
95+ G_out = nx .DiGraph () if directed else nx .Graph ()
96+
9597 _fill_from_layer (G_out , G_in )
9698 return G_out
You can’t perform that action at this time.
0 commit comments