python-igraph manual

For using igraph from Python

   Home       Trees       Indices       Help   
Package igraph :: Module cut :: Class Flow
[hide private]

Class Flow

source code

             object --+            
                      |            
  clustering.Clustering --+        
                          |        
clustering.VertexClustering --+    
                              |    
                            Cut --+
                                  |
                                 Flow

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"
Instance Methods [hide private]
 
__init__(self, graph, value, flow, cut, partition)
Initializes the flow.
source code
 
__repr__(self)
repr(x)
source code
 
__str__(self)
str(x)
source code

Inherited from clustering.VertexClustering: __plot__, as_cover, cluster_graph, crossing, giant, recalculate_modularity, subgraph, subgraphs

Inherited from clustering.Clustering: __getitem__, __iter__, __len__, compare_to, size, size_histogram, sizes, summary

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Class Methods [hide private]

Inherited from clustering.VertexClustering: FromAttribute

Class Variables [hide private]

Inherited from clustering.VertexClustering (private): _default_palette

Properties [hide private]
  flow
Returns the flow values for each edge.

Inherited from Cut: cut, es, partition, value

Inherited from clustering.VertexClustering: graph, modularity, q

Inherited from clustering.Clustering: membership, n

Inherited from object: __class__

Method Details [hide private]

__init__(self, graph, value, flow, cut, partition)
(Constructor)

source code 

Initializes the flow.

This should not be called directly, everything is taken care of by Graph.maxflow.

Parameters:
  • graph - the graph that will be associated to the clustering
  • membership - the membership list. The length of the list must be equal to the number of vertices in the graph. If None, every vertex is assumed to belong to the same cluster.
  • modularity - the modularity score of the clustering. If None, it will be calculated when needed.
  • params - additional parameters to be stored in this object.
  • modularity_params - arguments that should be passed to Graph.modularity when the modularity is (re)calculated. If the original graph was weighted, you should pass a dictionary containing a weight key with the appropriate value here.
Overrides: object.__init__

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: object.__repr__
(inherited documentation)

__str__(self)
(Informal representation operator)

source code 

str(x)

Overrides: object.__str__
(inherited documentation)

Property Details [hide private]

flow

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.

Get Method:
unreachable.flow(self) - Returns the flow values for each edge.

   Home       Trees       Indices       Help