sgtl.random.ssbm#

sgtl.random.ssbm(n: int, k: int, p: float, q: float, directed=False)#

Generate a graph from the symmetric stochastic block model.

Generates a graph with n vertices and k clusters. Every cluster will have \(\lfloor n/k \rfloor\) vertices. The probability of each edge inside a cluster is given by \(p\). The probability of an edge between two different clusters is \(q\).

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

  • k – The number of clusters.

  • p – The probability of an edge inside a cluster.

  • q – The probability of an edge between clusters.

  • directed – Whether to generate a directed graph.

Returns:

The generated graph as an sgtl.graph.Graph object.