graphit.graph_utils package¶
graphit.graph_utils.graph_utilities module¶
-
graphit.graph_utils.graph_utilities.
edges_parent_to_subgraph
(subgraph, parent=None)¶ Return edges connecting a subgraph with the parent graph
‘subgraph.origin’ is used as parent graph by default to derive connections. This will no longer work in case a copy is made of the subgraph as it will reset the link to the parent. The parent argument can be used to specify a dedicated parent graph in these and all other cases where connected edges between two separate graphs that share the same node ID’s needs to be determined.
- Parameters
subgraph (:graphit:Graph) – subgraph
parent (:graphit:Graph) – dedicated parent graph to derive connections to/from
- Returns
edges connecting graphs
- Return type
:py:list
-
graphit.graph_utils.graph_utilities.
graph_directional_to_undirectional
(graph)¶ Convert a directional to an undirectional graph
Returns a deep copy of the full graph with all directional edges duplicated as undirectional ones. Undirectional edges share the same data dictionary. In converting directional to undirectional edges their data dictionaries will be merged.
Note
dictionary merging may result in undesirable results due to data overwrite.
- Parameters
graph (:graphit:Graph) – Graph to convert
- Returns
Directional graph
- Return type
:graphit:Graph
-
graphit.graph_utils.graph_utilities.
graph_undirectional_to_directional
(graph)¶ Convert a undirectional to a directional graph
Returns a deep copy of the full graph with all undirectional edges duplicated as directional ones.
In an undirectional edge the egde pair shares a single attribute dictionary. This dictionary gets duplicated to the unique directional edges.
- Parameters
graph (:graphit:Graph) – Graph to convert
- Returns
Directional graph
- Return type
:graphit:Graph