Skip to content

Commit e15b81a

Browse files
committed
consistency fixes
1 parent 6ee751b commit e15b81a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

graphs/random_graph_generator.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,16 @@ def random_graph(
1313
vertices_number: int, probability: float, directed: bool = False
1414
) -> dict:
1515
"""
16-
Function that generates a random graph
16+
Generate a random graph
1717
@input: vertices_number (number of vertices),
1818
probability (probability that a generic edge (u,v) exists),
1919
directed (if True: graph will be a directed graph,
2020
otherwise it will be an undirected graph)
2121
@examples:
22+
>>> random.seed(1)
2223
>>> random_graph(4, 0.5)
2324
{0: [1], 1: [0, 2, 3], 2: [1, 3], 3: [1, 2]}
25+
>>> random.seed(1)
2426
>>> random_graph(4, 0.5, True)
2527
{0: [1], 1: [2, 3], 2: [3], 3: []}
2628
"""
@@ -33,7 +35,6 @@ def random_graph(
3335
if probability <= 0:
3436
return graph
3537

36-
random.seed(1)
3738
# for each couple of nodes, add an edge from u to v
3839
# if the number randomly generated is greater than probability probability
3940
for i in range(vertices_number):
@@ -48,7 +49,7 @@ def random_graph(
4849

4950
def complete_graph(vertices_number: int) -> dict:
5051
"""
51-
Function that generates a complete graph with vertices_number vertices.
52+
Generate a complete graph with vertices_number vertices.
5253
@input: vertices_number (number of vertices),
5354
directed (False if the graph is undirected, True otherwise)
5455
@example:

0 commit comments

Comments
 (0)