Skip to content


Source: flowmachine/core/mixins/

Mixin providing utility methods for graph type queries.

Class GraphMixin

Source: flowmachine/core/mixins/

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.



to_networkx(self, source=None, target=None, directed_graph=True)
Source: flowmachine/core/mixins/

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.

  • 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, default True

    Set to false to return an undirected graph.

  • networkx.Graph

    This query as a networkx graph object.