Skip to content

Commit

Permalink
fix : math.comb dependency removed.
Browse files Browse the repository at this point in the history
  • Loading branch information
sadrasabouri committed Sep 30, 2024
1 parent 958a038 commit 28f712d
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions pyrgg/engines/erdos_reyni.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
"""Erdős-Rényi Engine module."""
import datetime
from random import shuffle
from math import comb
from itertools import permutations
from pyrgg.params import ENGINE_MENU, PYRGG_LOGGER_ERROR_MESSAGE

LOGGER_TEMPLATE = """{0}
Expand Down Expand Up @@ -32,12 +30,13 @@ def edge_gen(n, m, direct):
edge_dic = {}
weight_list = []
edge_mold = []
TOTAL_EDGE = (n * (n - 1)) // 2
if direct:
m = min(m, 2 * comb(n, 2))
edge_mold = m * [1] + (2 * comb(n, 2) - m) * [0]
m = min(m, 2 * TOTAL_EDGE)
edge_mold = m * [1] + (2 * TOTAL_EDGE - m) * [0]
else:
m = min(m, comb(n, 2))
edge_mold = m * [1] + (comb(n, 2) - m) * [0]
m = min(m, TOTAL_EDGE)
edge_mold = m * [1] + (TOTAL_EDGE - m) * [0]
shuffle(edge_mold)
for i in range(1, n + 1):
edge_dic[i] = []
Expand Down

0 comments on commit 28f712d

Please sign in to comment.