Commit 3d7826bc authored by Antoine Kaufmann's avatar Antoine Kaufmann Committed by Hejing Li
Browse files

experiments: e2e partitioner now also returns dot rendering, e2e_bgsplit experiment saves it

parent 6b37db23
......@@ -59,7 +59,7 @@ for N in splits:
add_contig_bg(topology)
# Partition into N ns-3 processes
nets = e2e_part.partition(topology, N)
nets, dot = e2e_part.partition(topology, N)
for net in nets:
net.e2e_global.stop_time = '1s'
net.opt = ' '.join([f'--{o[0]}={o[1]}' for o in options.items()])
......@@ -67,4 +67,7 @@ for N in splits:
e.add_network(net)
net.init_network()
with open(f'out/{e.name}.dot', 'w') as f:
f.write(dot)
experiments.append(e)
......@@ -94,16 +94,17 @@ def partition(topology, N):
node_partitions[p].append(i)
# For debugging: print out dot representation of partition
#print('graph R {')
#for p in sorted(node_partitions.keys()):
# print(f'subgraph cluster{p} {{')
# for n_i in node_partitions[p]:
# n = idmap.from_id(n_i)
# print(f'n{n_i} [label="{n.id}"];')
# print('}')
#for (s,d) in edges:
# print(f'n{s} -- n{d};')
#print('}')
dot = 'graph R {\n'
for p in sorted(node_partitions.keys()):
dot += f'subgraph cluster{p} {{\n'
dot += f'label = "netpart_{p}";\n'
for n_i in node_partitions[p]:
n = idmap.from_id(n_i)
dot += f'n{n_i} [label="{n.id}"];\n'
dot += '}\n'
for (s,d) in edges:
dot += f'n{s} -- n{d};\n'
dot += '}'
# create the networks
......@@ -158,4 +159,4 @@ def partition(topology, N):
con_a.set_peer(lst_a)
con.add_component(con_a)
return networks
return (networks, dot)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment