List of all classes, functions and methods in python-igraph
class Flow(Cut):
A flow of a given graph.
This is a simple class used to represent flows returned by Graph.maxflow
. It has the following attributes:
graph
- the graph on which this flow is definedvalue
- the value (capacity) of the flowflow
- the flow values on each edge. For directed graphs, this is simply a list where element i corresponds to the flow on edge i. For undirected graphs, the direction of the flow is not constrained (since the edges are undirected), hence positive flow always means a flow from the smaller vertex ID to the larger, while negative flow means a flow from the larger vertex ID to the smaller.cut
- edge IDs in the minimal cut corresponding to the flow.partition
- vertex IDs in the parts created after removing edges in the cutes
- an edge selector restricted to the edges in the cut.This class is usually not instantiated directly, everything is taken care of by Graph.maxflow
.
Examples:
>>> from igraph import Graph >>> g = Graph.Ring(20) >>> mf = g.maxflow(0, 10) >>> print(mf.value) 2.0 >>> mf.es["color"] = "red"
Method | __init__ |
Initializes the flow. |
Method | __repr__ |
Undocumented |
Method | __str__ |
Undocumented |
Property | flow |
Returns the flow values for each edge. |
Instance Variable | _flow |
Undocumented |
Inherited from Cut
:
Property | es |
Returns an edge selector restricted to the cut |
Property | partition |
Returns the vertex IDs partitioned according to the cut |
Property | cut |
Returns the edge IDs in the cut |
Property | value |
Returns the sum of edge capacities in the cut |
Instance Variable | _value |
Undocumented |
Instance Variable | _partition |
Undocumented |
Instance Variable | _cut |
Undocumented |
igraph.cut.Cut.__init__
Initializes the flow.
This should not be called directly, everything is taken care of by Graph.maxflow
.
Returns the flow values for each edge.
For directed graphs, this is simply a list where element i corresponds to the flow on edge i. For undirected graphs, the direction of the flow is not constrained (since the edges are undirected), hence positive flow always means a flow from the smaller vertex ID to the larger, while negative flow means a flow from the larger vertex ID to the smaller.