color edge types

master
loooph 2023-03-01 03:59:42 +01:00
parent 87e6a0e770
commit d93f2b9c64
1 changed files with 11 additions and 1 deletions

View File

@ -8,6 +8,15 @@ edge_attrs = {
'arrowhead': 'vee',
}
edge_colors = {
'T': 'red',
'F': 'yellow',
'B': 'green',
'X': 'blue',
'L': 'purple',
}
g = Digraph('G', filename='graph.gv', format='png', engine='circo', strict=True, edge_attr = edge_attrs)
g_lock = threading.Lock()
@ -30,7 +39,7 @@ def print_edge(address, *args):
if v == -1:
return
with g_lock:
g.edge(str(v), str(w))
g.edge(str(v), str(w), color=edge_colors[t])
print(args)
def update_loop():
@ -38,6 +47,7 @@ def update_loop():
g.render("Test")
time.sleep(0.4)
ul_thread = threading.Thread(target=update_loop)
ul_thread.start()