flowmachine.core.mixins.graph_mixin¶
Source: flowmachine/core/mixins/graph_mixin.py
Mixin providing utility methods for graph type queries.
Class GraphMixin¶
GraphMixin()
Supplies utility functions for graph-like queries, specifically the to_networkx function which returns a networkx graph which can then be analysed further using standard libraries.
Methods¶
to_networkx¶
to_networkx(self, source=None, target=None, directed_graph=True)
By default, the leftmost column will be used as the source, the next leftmost as the target, and any other columns will become edge attributes. Both or neither of source and target should be provided. The default is to return a directed graph.
Parameters¶
-
source
:optional
,str
Optionally specify the column name for the source nodes.
-
target
:optional
,str
Optionally specify the column name for the target nodes.
-
directed_graph
:bool
, defaultTrue
Set to false to return an undirected graph.
Returns¶
-
networkx.Graph
This query as a networkx graph object.