Skip to content
Snippets Groups Projects
Commit fb59ea98 authored by Steinmann's avatar Steinmann
Browse files

created loop to define Flow for each node and Edge

parent 4238e065
No related branches found
No related tags found
No related merge requests found
......@@ -12,23 +12,22 @@ def construct_graph(*nodes):
else:
continue
#erstelle einen Knoten für alle Übergebenen Knoten
edges=[]
we=[]
for node in nodes:
#für jeden String in den übergebenen Daten wird ein Knoten erstellt
if isinstance(node, str):
graph.add_node(node)
#für jeden übergebenen touple der 2 knoten enthält wird eine Kante erstellt
elif isinstance(node , tuple) and len(node)==2 :
if isinstance(node.__getitem__(0),str) and isinstance(node.__getitem__(1),str):
graph.add_edge(node.__getitem__(0), node.__getitem__(1))
else:
print('Kante enthält unbekannten Knoten')
else:
print('Argument ist weder knoten noch Kante')
edges.append(node)
elif isinstance(node , tuple) and len(node)==3 :
we.append(node)
continue
pos = nx.spring_layout(graph)
graph.add_edges_from(edges)
graph.add_weighted_edges_from(we)
pos = nx.shell_layout(graph)
#berechnung der Knotengröße entsprechend der Beschriftungs argumente
nx.draw_networkx_nodes(graph, pos, node_size = sizeA*325, node_color='white', edgecolors='black',linewidths=1)
......
This diff is collapsed.
Source diff could not be displayed: it is too large. Options to address this: view the blob.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment