Class Cut
object --+
|
Cut
A cut of a given graph.
This is a simple class used to represent cuts returned by Graph.mincut. It
has the following attributes:
-
graph
- the graph on which this cut is defined
-
value
- the value (capacity) of the cut
-
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.
Attributes are not read only, but you should consider them as being
read only. Unexpected behaviour may occur if you mess with them.
You can use indexing on this object to obtain VertexSeq objects of
the partitions.
This class is usually not instantiated directly, everything is taken
care of by Graph.mincut.
Examples:
>>> g = Graph.Ring(20)
>>> mc = g.mincut()
>>> print mc.value
2
>>> print min(map(len, mc))
1
>>> mc.es["color"] = ["red"] * len(mc.es)
|
|
|
__init__(self,
graph,
value,
cut,
partition,
partition2)
Initializes the cut. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Inherited from object :
__delattr__ ,
__getattribute__ ,
__hash__ ,
__new__ ,
__reduce__ ,
__reduce_ex__ ,
__setattr__
|
|
_cut
|
|
_graph
|
|
_partition
|
|
_value
|
|
cut
Edge IDs in the cut
|
|
es
Returns an edge selector restricted to the cut
|
|
graph
The graph over which this cut is defined
|
|
partition
Vertex IDs partitioned according to the cut
|
|
value
Sum of edge capacities in the cut
|
Inherited from object :
__class__
|
__init__(self,
graph,
value,
cut,
partition,
partition2)
(Constructor)
|
|
Initializes the cut.
This should not be called directly, everything is taken care of by Graph.mincut.
- Overrides:
object.__init__
|
__repr__(self)
(Representation operator)
|
|
repr(x)
- Overrides:
object.__repr__
- (inherited documentation)
|
__str__(self)
(Informal representation operator)
|
|
str(x)
- Overrides:
object.__str__
- (inherited documentation)
|
cut
Edge IDs in the cut
- Get Method:
- _get_cut(self)
|
es
Returns an edge selector restricted to the cut
- Get Method:
- _get_es(self)
|
graph
The graph over which this cut is defined
- Get Method:
- _get_graph(self)
|
partition
Vertex IDs partitioned according to the cut
- Get Method:
- _get_partition(self)
|
value
Sum of edge capacities in the cut
- Get Method:
- _get_value(self)
|