src.wsi.cluster_wsbm#

Module Contents#

Classes#

ClusterWSBM

Functions#

_nxgraph_to_graphtoolgraph(graph)

Convert a networkx graph to a graphtool graph.

_minimize(→ graph_tool.inference.blockmodel.BlockState)

Minimize the graph using the given distribution as described by graph-tool.

src.wsi.cluster_wsbm._nxgraph_to_graphtoolgraph(graph: networkx.Graph)#

Convert a networkx graph to a graphtool graph.

Parameters:

graph (nx.Graph) – The graph to convert

Returns:

The converted graph

Return type:

graphtool.Graph

src.wsi.cluster_wsbm._minimize(graph: graph_tool.Graph, distribution: str) graph_tool.inference.blockmodel.BlockState#

Minimize the graph using the given distribution as described by graph-tool.

Parameters:
  • graph (graph_tool.Graph) – The graph to minimize

  • distribution (str) – The distribution to use for the WSBM algorithm.

Returns:

The minimized graph as BlockState object.

Return type:

BlockState

class src.wsi.cluster_wsbm.ClusterWSBM#

Bases: src.wsi.model.WSIModel

distribution: Literal[real-exponential, discrete-poisson, discrete-geometric, discrete-binomial, real-normal]#
predict(uses: list[src.use.Use]) list[int]#