add edge attributes

master
loooph 2023-03-01 02:17:00 +01:00
parent 3daa865022
commit 690e81cea3
1 changed files with 10 additions and 3 deletions

View File

@ -2,7 +2,11 @@ from graphviz import Digraph
from pythonosc.dispatcher import Dispatcher
from pythonosc.osc_server import BlockingOSCUDPServer
g = Digraph('G', filename='graph.gv', format='pdf')
edge_attrs = {
'arrowhead': 'vee',
}
g = Digraph('G', filename='graph.gv', format='pdf', engine='circo', strict=True, edge_attr = edge_attrs)
# last vertex received
v = -1
@ -13,12 +17,14 @@ t = ""
def print_vertex(address, *args):
global v
global g
v = args[args.index('vertex') + 1]
if v == -1:
g = Digraph('G', filename='graph.gv', format='pdf', engine='circo', strict=True, edge_attr = edge_attrs)
return
g.node(str(v))
g.render("Test")
print(v)
print(args)
def print_edge(address, *args):
global v
@ -26,7 +32,8 @@ def print_edge(address, *args):
global t
w = args[args.index('w') + 1]
t = args[args.index('edge_type') + 1]
print((v,w,t))
print(args)
# print((v,w,t))
if v == -1 or w == -1:
return
g.edge(str(v), str(w))