sgtl.random.sbm_equal_clusters#

sgtl.random.sbm_equal_clusters(n, k, prob_mat_q, directed=False)#

Generate a graph with equal cluster sizes from the stochastic block model.

Generates a graph with n vertices and k clusters. Every cluster will have floor(n/k) vertices. The probability of each edge inside a cluster is given by the probability matrix Q as described in the sbm method.

Parameters:
  • n – The number of vertices in the graph.

  • k – The number of clusters.

  • prob_mat_q – q[i][j] gives the probability of an edge between clusters i and j

  • directed – Whether to generate a directed graph.

Returns:

The generated graph as an sgtl.Graph object.