def fit_predict(self, graph, weights):
    "Fits model to a given graph and weights list\n\n        Sets :code:`self.model_` to the state of graphtool's Stochastic Block Model the after fitting.\n\n        Attributes\n        ----------\n        graph: graphtool.Graph\n            the graph to fit the model to\n        weights: graphtool.EdgePropertyMap<double>\n            the property map: edge -> weight (double) to fit the model to, if weighted variant\n            is selected\n\n        Returns\n        -------\n        numpy.ndarray\n            partition of labels, each sublist contains label indices\n            related to label positions in :code:`y`\n        "
    if self.weight_model:
        self.model_ = self._model_fit_function()(graph, deg_corr=self.use_degree_correlation, overlap=self.allow_overlap, state_args=dict(recs=[weights], rec_types=[self.weight_model]))
    else:
        self.model_ = self._model_fit_function()(graph, deg_corr=self.use_degree_correlation, overlap=self.allow_overlap)
    return self._detect_communities()
Fits model to a given graph and weights list

Sets :code:`self.model_` to the state of graphtool's Stochastic Block Model the after fitting.

Attributes
----------
graph: graphtool.Graph
    the graph to fit the model to
weights: graphtool.EdgePropertyMap<double>
    the property map: edge -> weight (double) to fit the model to, if weighted variant
    is selected

Returns
-------
numpy.ndarray
    partition of labels, each sublist contains label indices
    related to label positions in :code:`y`
def fit_predict(self, graph, weights):
    "Fits model to a given graph and weights list\n\n        Sets :code:`self.model_` to the state of graphtool's Stochastic Block Model the after fitting.\n\n        Attributes\n        ----------\n        graph: graphtool.Graph\n            the graph to fit the model to\n        weights: graphtool.EdgePropertyMap<double>\n            the property map: edge -> weight (double) to fit the model to, if weighted variant\n            is selected\n\n        Returns\n        -------\n        numpy.ndarray\n            partition of labels, each sublist contains label indices\n            related to label positions in :code:`y`\n        "
    if self.weight_model:
        self.model_ = self._model_fit_function()(graph, deg_corr=self.use_degree_correlation, overlap=self.allow_overlap, state_args=dict(recs=[weights], rec_types=[self.weight_model]))
    else:
        self.model_ = self._model_fit_function()(graph, deg_corr=self.use_degree_correlation, overlap=self.allow_overlap)
    return self._detect_communities()