(self, graph, blocks=None, cohesion=None, parent=None)
Constructs a new cohesive block structure for the given graph.

        If any of I{blocks}, I{cohesion} or I{parent} is C{None}, all the
        arguments will be ignored and L{Graph.cohesive_blocks()} will be
        called to calculate the cohesive blocks. Otherwise, these three
        variables should describe the *result* of a cohesive block structure
        calculation. Chances are that you never have to construct L{CohesiveBlocks}
        instances directly, just use L{Graph.cohesive_blocks()}.

        @param graph: the graph itself
        @param blocks: a list containing the blocks; each block is described
          as a list containing vertex IDs.
        @param cohesion: the cohesion of each block. The length of this list
          must be equal to the length of I{blocks}.
        @param parent: the parent block of each block. Negative values or
          C{None} mean that there is no parent block for that block. There
          should be only one parent block, which covers the entire graph.
        @see: Graph.cohesive_blocks()
Constructs a new cohesive block structure for the given graph.
Constructs a new cohesive block structure for the given graph .
def __init__(self, graph, blocks=None, cohesion=None, parent=None):
        """Constructs a new cohesive block structure for the given graph.

        If any of I{blocks}, I{cohesion} or I{parent} is C{None}, all the
        arguments will be ignored and L{Graph.cohesive_blocks()} will be
        called to calculate the cohesive blocks. Otherwise, these three
        variables should describe the *result* of a cohesive block structure
        calculation. Chances are that you never have to construct L{CohesiveBlocks}
        instances directly, just use L{Graph.cohesive_blocks()}.

        @param graph: the graph itself
        @param blocks: a list containing the blocks; each block is described
          as a list containing vertex IDs.
        @param cohesion: the cohesion of each block. The length of this list
          must be equal to the length of I{blocks}.
        @param parent: the parent block of each block. Negative values or
          C{None} mean that there is no parent block for that block. There
          should be only one parent block, which covers the entire graph.
        @see: Graph.cohesive_blocks()
        """
        if blocks is None or cohesion is None or parent is None:
            blocks, cohesion, parent = graph.cohesive_blocks()

        VertexCover.__init__(self, graph, blocks)

        self._cohesion = cohesion
        self._parent = parent
        for idx, p in enumerate(self._parent):
            if p < 0:
                self._parent[idx] = None
def __init__ ( self , graph , blocks = None , cohesion = None , parent = None ) : if blocks is None or cohesion is None or parent is None : blocks , cohesion , parent = graph . cohesive_blocks ( ) VertexCover . __init__ ( self , graph , blocks ) self . _cohesion = cohesion self . _parent = parent for idx , p in enumerate ( self . _parent ) : if p < 0 : self . _parent [ idx ] = None