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

WIP: all tests pass

This commit is contained in:
J. Fernando Sánchez
2022-10-13 22:43:16 +02:00
parent f811ee18c5
commit cd62c23cb9
46 changed files with 1720 additions and 1434 deletions

View File

@@ -2,7 +2,7 @@
name: custom-generator
description: Using a custom generator for the network
num_trials: 3
max_time: 100
max_steps: 100
interval: 1
network_params:
generator: mymodule.mygenerator

View File

@@ -1,4 +1,5 @@
from networkx import Graph
import random
import networkx as nx
def mygenerator(n=5, n_edges=5):
@@ -13,9 +14,9 @@ def mygenerator(n=5, n_edges=5):
for i in range(n_edges):
nodes = list(G.nodes)
n_in = self.random.choice(nodes)
n_in = random.choice(nodes)
nodes.remove(n_in) # Avoid loops
n_out = self.random.choice(nodes)
n_out = random.choice(nodes)
G.add_edge(n_in, n_out)
return G