(
        self,
        graph,
        membership=None,
        modularity=None,
        params=None,
        modularity_params=None,
    )
Creates a clustering object for a given graph.

        @param graph: the graph that will be associated to the clustering
        @param membership: the membership list. The length of the list must
          be equal to the number of vertices in the graph. If C{None}, every
          vertex is assumed to belong to the same cluster.
        @param modularity: the modularity score of the clustering. If C{None},
          it will be calculated when needed.
        @param params: additional parameters to be stored in this object.
        @param modularity_params: arguments that should be passed to
          L{Graph.modularity} when the modularity is (re)calculated. If the
          original graph was weighted, you should pass a dictionary
          containing a C{weight} key with the appropriate value here.
Creates a clustering object for a given graph.
Creates a clustering object for a given graph .
def __init__(
        self,
        graph,
        membership=None,
        modularity=None,
        params=None,
        modularity_params=None,
    ):
        """Creates a clustering object for a given graph.

        @param graph: the graph that will be associated to the clustering
        @param membership: the membership list. The length of the list must
          be equal to the number of vertices in the graph. If C{None}, every
          vertex is assumed to belong to the same cluster.
        @param modularity: the modularity score of the clustering. If C{None},
          it will be calculated when needed.
        @param params: additional parameters to be stored in this object.
        @param modularity_params: arguments that should be passed to
          L{Graph.modularity} when the modularity is (re)calculated. If the
          original graph was weighted, you should pass a dictionary
          containing a C{weight} key with the appropriate value here.
        """
        if membership is None:
            Clustering.__init__(self, [0] * graph.vcount(), params)
        else:
            if len(membership) != graph.vcount():
                raise ValueError("membership list has invalid length")
            Clustering.__init__(self, membership, params)

        self._graph = graph
        self._modularity = modularity
        self._modularity_dirty = modularity is None
        if modularity_params is None:
            self._modularity_params = {}
        else:
            self._modularity_params = dict(modularity_params)
def __init__ ( self , graph , membership = None , modularity = None , params = None , modularity_params = None , ) : if membership is None : Clustering . __init__ ( self , [ 0 ] * graph . vcount ( ) , params ) else : if len ( membership ) != graph . vcount ( ) : raise ValueError ( "membership list has invalid length" ) Clustering . __init__ ( self , membership , params ) self . _graph = graph self . _modularity = modularity self . _modularity_dirty = modularity is None if modularity_params is None : self . _modularity_params = { } else : self . _modularity_params = dict ( modularity_params )