Class Cut
source code
object +

clustering.Clustering +

clustering.VertexClustering +

Cut
 Known Subclasses:

A cut of a given graph.
This is a simple class used to represent cuts returned by Graph.mincut(), Graph.all_st_cuts() and other functions that calculate
cuts.
A cut is a special vertex clustering with only two clusters. Besides
the usual VertexClustering methods, it also has the following
attributes:

value
 the value (capacity) of the cut. It is equal to
the number of edges if there are no capacities on the edges.

partition
 vertex IDs in the parts created after
removing edges in the cut

cut
 edge IDs in the cut

es
 an edge selector restricted to the edges in the
cut.
You can use indexing on this object to obtain lists of vertex IDs for
both sides of the partition.
This class is usually not instantiated directly, everything is taken
care of by the functions that return cuts.
Examples:
>>> from igraph import Graph
>>> g = Graph.Ring(20)
>>> mc = g.mincut()
>>> print mc.value
2.0
>>> print min(map(len, mc))
1
>>> mc.es["color"] = "red"

__init__(self,
graph,
value=None,
cut=None,
partition=None,
partition2=None)
Initializes the cut. 
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__

__init__(self,
graph,
value=None,
cut=None,
partition=None,
partition2=None)
(Constructor)
 source code

Initializes the cut.
This should not be called directly, everything is taken care of by the
functions that return cuts.
 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(x)
 Overrides:
object.__repr__
 (inherited documentation)

__str__(self)
(Informal representation operator)
 source code

str(x)
 Overrides:
object.__str__
 (inherited documentation)

es
Returns an edge selector restricted to the cut
 Get Method:
 unreachable.es(self)
 Returns an edge selector restricted to the cut

partition
Returns the vertex IDs partitioned according to the cut
 Get Method:
 unreachable.partition(self)
 Returns the vertex IDs partitioned according to the cut

cut
Returns the edge IDs in the cut
 Get Method:
 unreachable.cut(self)
 Returns the edge IDs in the cut

value
Returns the sum of edge capacities in the cut
 Get Method:
 unreachable.value(self)
 Returns the sum of edge capacities in the cut
