graph = AGraph(strict = False, directed = True)# Set the style attributes of the graphgraph.node_attr['style']='rounded'graph.node_attr['shape']='box'graph.node_attr['fixedsize']='false'graph.node_attr['labelloc']='c'graph.node_attr['fontname']='times'graph.node_attr['fontcolor']='purple'
key_str = destination_port+"_"+source_port# Get the data from the dictionary and work on ingraph.add_edge(source,destination,key=key_str,dir='both',taillabel=destination_port,headlabel=source_port,style='bold',color='blue')
graph { node [fixedsize=false, fontcolor=red, fontname=times, label="\N", labelloc=c, shape=box, style=rounded ]; r1_re [fontcolor=purple, label=r1_re]; r2_re0 [label=r2_re0]; r1_re -- r2_re0 [key="abc_def", color=blue, dir=both, headlabel="abc", style=bold, taillabel="xyz"];}
graph { node [fixedsize=false, fontcolor=red, fontname=times, label="\N", labelloc=c, shape=box, style=rounded ]; r1_re [fontcolor=purple, label=r1_re]; r2_re0 [label=r2_re0]; r1_re -- r2_re0 [key="abc_def", color=blue, dir=both, headlabel="abc", style=bold, taillabel="def"]; r1_re -- r2_re0 [key="abc_xyz", color=blue, dir=both, headlabel="abc", style=bold, taillabel="xyz"];}