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 defined
- value - the value (capacity) of the flow
- flow - 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 cut
- es - 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 | cut | Returns the edge IDs in the cut | 
| Property | es | Returns an edge selector restricted to the cut | 
| Property | partition | Returns the vertex IDs partitioned according to the cut | 
| Property | value | Returns the sum of edge capacities in the cut | 
| Instance Variable | _cut | Undocumented | 
| Instance Variable | _partition | Undocumented | 
| Instance Variable | _value | Undocumented | 
              Inherited from VertexClustering (via Cut):
            
| Class Method |  | Creates a vertex clustering based on the value of a vertex attribute. | 
| Method | __plot__ | Plots the clustering to the given Cairo context or matplotlib Axes. | 
| Method | as | Returns a VertexCoverthat contains the same clusters as this clustering. | 
| Method | cluster | Returns a graph where each cluster is contracted into a single vertex. | 
| Method | crossing | Returns a boolean vector where element i is True iff edge i lies between clusters, False otherwise. | 
| Method | giant | Returns the largest cluster of the clustered graph. | 
| Method | recalculate | Recalculates the stored modularity value. | 
| Method | subgraph | Get the subgraph belonging to a given cluster. | 
| Method | subgraphs | Gets all the subgraphs belonging to each of the clusters. | 
| Property | graph | Returns the graph belonging to this object | 
| Property | modularity | Returns the modularity score | 
| Method | _formatted | Iterates over the clusters and formats them into a string to be presented in the summary. | 
| Method | _recalculate | Recalculates the stored modularity value and swallows all exceptions raised by the modularity function (if any). | 
| Class Variable | _default | Undocumented | 
| Instance Variable | _graph | Undocumented | 
| Instance Variable | _modularity | Undocumented | 
| Instance Variable | _modularity | Undocumented | 
| Instance Variable | _modularity | Undocumented | 
              Inherited from Clustering (via Cut, VertexClustering):
            
| Method | __getitem__ | Returns the members of the specified cluster. | 
| Method | __iter__ | Iterates over the clusters in this clustering. | 
| Method | __len__ | Returns the number of clusters. | 
| Method | compare | Compares this clustering to another one using some similarity or distance metric. | 
| Method | size | Returns the size of a given cluster. | 
| Method | size | Returns the histogram of cluster sizes. | 
| Method | sizes | Returns the size of given clusters. | 
| Method | summary | Returns the summary of the clustering. | 
| Property | membership | Returns the membership vector. | 
| Property | n | Returns the number of elements covered by this clustering. | 
| Instance Variable | _len | Undocumented | 
| Instance Variable | _membership | Undocumented | 
igraph.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.