1
0
mirror of https://github.com/gsi-upm/soil synced 2025-08-24 03:52:20 +00:00

black formatting

This commit is contained in:
J. Fernando Sánchez
2022-10-17 20:23:57 +02:00
parent 227fdf050e
commit 880a9f2a1c
19 changed files with 431 additions and 329 deletions

View File

@@ -2,16 +2,17 @@ from networkx import Graph
import random
import networkx as nx
def mygenerator(n=5, n_edges=5):
'''
"""
Just a simple generator that creates a network with n nodes and
n_edges edges. Edges are assigned randomly, only avoiding self loops.
'''
"""
G = nx.Graph()
for i in range(n):
G.add_node(i)
for i in range(n_edges):
nodes = list(G.nodes)
n_in = random.choice(nodes)
@@ -19,9 +20,3 @@ def mygenerator(n=5, n_edges=5):
n_out = random.choice(nodes)
G.add_edge(n_in, n_out)
return G