The following code for generating a graph from the stochastic block model fails with out-of-bounds errors.
import sgtl.random
import numpy as np
def main():
cluster_sizes = [100, 50, 20, 20, 20]
p = 0.8
prob_mat_q = np.asarray([[p, 0.2, 0.5, 0.1, 0.1],
[0.2, p, 0.1, 0.6, 0.2],
[0.5, 0.1, p, 0.2, 0.1],
[0.1, 0.6, 0.2, p, 0.5],
[0.1, 0.2, 0.1, 0.5, p]])
graph = sgtl.random.sbm(cluster_sizes, prob_mat_q)
if __name__ == '__main__':
main()
Traceback (most recent call last):
File ".../main.py", line 17, in <module>
main()
File ".../main.py", line 13, in main
graph = sgtl.random.sbm(cluster_sizes, prob_mat_q)
File ".../venv/lib/python3.8/site-packages/sgtl/random.py", line 179, in sbm
adj_mat[vertex_1, vertex_2] = 1
File ".../venv/lib/python3.8/site-packages/scipy/sparse/_lil.py", line 330, in __setitem__
return self._set_intXint(key[0], key[1], x)
File ".../venv/lib/python3.8/site-packages/scipy/sparse/_lil.py", line 299, in _set_intXint
_csparsetools.lil_insert(self.shape[0], self.shape[1], self.rows,
File "_csparsetools.pyx", line 61, in scipy.sparse._csparsetools.lil_insert
File "_csparsetools.pyx", line 87, in scipy.sparse._csparsetools.lil_insert
IndexError: column index (240) out of bounds