10 from cStringIO
import StringIO
11 from copy
import deepcopy
17 import matplotlib.pyplot
as plt
19 import coolfluid
as cf
27 componentcolor=
'#aaaaaa'
33 propertycolor=
'#cc4444'
38 cf3_b64=
"""iVBORw0KGgoAAAANSUhEUgAAADIAAAAgCAYAAABQISshAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9wBFRM6KYr0o9UAA
39 AAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAJpUlEQVRYw61YT4hdVxn/fd93zr33vTeTTCZJmzY2kCGlmPQfWqQtKCIupJtCF9qFQsFVtFCycJVFyMZlSEFQcOGmxCLdqt2JqC2V0
40 mqxVlBM2iammdZmZvJm3rv3/PlcnHPvu7ex7cQ6cDn3ngyT73d/f77vXDpz5syYmVZ3dpbvWV+/7VlmPlGWghhjvgJCSPdpDZ+475zv/U6Eqg7+FgBYW6Asy5cPHJBvHTq0feX8+R/GJ598Es8//zz+1
41 x/DzPtV5cT6+h2/Xlvbh/vvPwznPJrGd2vTBDjn8r1H0/TvG9R12qtrh7pusLGxDVUdgFCNUAWstTDGgtk8PJ3aX50/f/q+J5544jOBaIHcOZ1Ovr68XODEiTswn7sBEOcCmsZ1awvEOY+6Ts9pdd0zo
42 B0bfUAiBsZYGGNgrSERe+9TT507fvTojbdeeeWVXRUcQkBd13ry5ElcunQJFy5cSEAA/Zxz/ODx47er94FS8QlAujy8Dz1gLbj+2oJPgEJYSCoxEcHMmQ2BMRYiiZkQ8Ijq1j+feeaZuBsgRIQYI4goH
43 j9+PJ46dUqfe+45NUQ4AOh+IiLnArwPcC7C+2HR3rcSG8qrL7m6buC9B6CqquR9RAjJF0VRADAgsiCyYLYwpsCIpnvu+/uF8cEqhNJYWGtQFBbWWhTWoLAWhc37eU+0Vuy94fHt383xwmNkJ98jA9AE0
44 CoB8B0LfUZS8UMQzgXUtYP3Hjs7Neq6aZnQG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XTm6MEZZEBtcbup5URVMJ4c32mMx9rM51O3fLy8haAnaZpTFmWrKp0K/NS/mA2YmZWFnzVvfbmC+ELjyQQ7QyVQLQTgVeCFYExDGGBkdQEk
59 xIICoIqEAD4CIgCEgGnAAWF14iXLs/08g1Pe+P05+aNN97Qw4cPu8lk4kejEa2trd0SCABYX1+H976JMf5bla6tYHrlK3jr4i/d0aONC2h8gGsCYlSQCMCMAMYHswBpAOEIIwwWn5IwT7xGsv45N71uT
60 yBCEBY64D546aFrL/6Y8H/6OX36tLHW7mfmewF8SZjuiUr7GuWC6ONMRt3weJMf6WOdqVAEELYJesmG+mWn/Lo5c+YMzp49+5mBhBBCURRbqvoPIvIh6jtE2FNyNJ/qN93lXu+/06jbAK558EXV+OF/A
61 OQy9FESRGTLAAAAAElFTkSuQmCC"""
71 fig=plt.figure(figsize=(10,10))
72 mainax=plt.axes([0,0,1,1],axisbg=bgcolor,label=
'main')
73 naviax=plt.axes([0.65,0.01,0.34,0.34],axisbg=bgcolor,label=
'navi')
77 mainax.xaxis.set_visible(
False)
78 mainax.yaxis.set_visible(
False)
79 for i
in mainax.spines: mainax.spines[i].set_visible(
False)
80 naviax.xaxis.set_visible(
False)
81 naviax.yaxis.set_visible(
False)
82 for i
in naviax.spines: naviax.spines[i].set_color(titlecolor)
83 naviax.set_visible(
False)
86 titletxt=plt.text(0.02,0.98,
'',transform=mainax.transAxes, size=16, weight=
'bold',color=titlecolor, ha=
'left', va=
'top',zorder=50)
87 cf3_png=StringIO(base64.decodestring(cf3_b64))
88 cf3_img=Image.open(cf3_png)
89 plt.imshow(cf3_img,aspect=
'auto',zorder=41)
90 plt.gca().add_patch(plt.Rectangle([20,5],12,22,facecolor=bgcolor,lw=0,fill=
True,zorder=40))
99 for i
in G.successors(key):
100 if G.node[i][
'tag']==
'link':
101 if not ((G.edge[key][i][
'tag']==
'link')
and (G.node[i][
'tag']!=
'link')) :
102 pos[i]=[G.node[i][
'depth'],y]
105 for i
in G.successors(key):
106 if G.node[i][
'tag']==
'option':
107 if not ((G.edge[key][i][
'tag']==
'link')
and (G.node[i][
'tag']!=
'link')) :
108 pos[i]=[G.node[i][
'depth'],y]
111 for i
in G.successors(key):
112 if G.node[i][
'tag']==
'tag':
113 if not ((G.edge[key][i][
'tag']==
'link')
and (G.node[i][
'tag']!=
'link')) :
114 pos[i]=[G.node[i][
'depth'],y]
117 for i
in G.successors(key):
118 if G.node[i][
'tag']==
'field':
119 if not ((G.edge[key][i][
'tag']==
'link')
and (G.node[i][
'tag']!=
'link')) :
120 pos[i]=[G.node[i][
'depth'],y]
123 for i
in G.successors(key):
124 if G.node[i][
'tag']==
'property':
125 if not ((G.edge[key][i][
'tag']==
'link')
and (G.node[i][
'tag']!=
'link')) :
126 pos[i]=[G.node[i][
'depth'],y]
129 for i
in G.successors(key):
130 if G.node[i][
'tag']==
'signal':
131 if not ((G.edge[key][i][
'tag']==
'link')
and (G.node[i][
'tag']!=
'link')) :
132 pos[i]=[G.node[i][
'depth'],y]
135 for i
in G.successors(key):
136 if G.node[i][
'tag']==
'component':
137 if not ((G.edge[key][i][
'tag']==
'link')
and (G.node[i][
'tag']!=
'link')) :
138 pos[i]=[G.node[i][
'depth'],y]
144 pos=dict(zip(G,numpy.tile(-999,(G.number_of_nodes(),2))))
145 pos[
'c:'+key]=[G.node[
'c:'+key][
'depth'],0]
147 for i
in G.pred[
'c:'+key]:
148 pos[i]=[G.node[i][
'depth'],G.node[i][
'depth']]
152 print "traditional_left2right_tree_layout: unplugged key: ", i, G.node[i]
160 for i
in pos: ymax=
max(float(pos[i][1]),float(ymax))
166 pos[i][0]=r*math.cos(fi)
167 pos[i][1]=r*math.sin(fi)
174 angle=dict.fromkeys(pos,float(0.))
176 for j
in G.successors(i):
177 if not ((G.node[j][
'tag']!=
'link')
and (G.edge[i][j][
'tag']==
'link')):
178 dx=float(pos[j][0]-pos[i][0])
179 dy=float(pos[j][1]-pos[i][1])
180 if not (dx==0.
and dy==0.):
181 angle[j] = -180./math.pi*math.atan2(dy,dx)
192 imx=float(img_.size[0])
193 imy=float(img_.size[1])
194 rootx,rooty=pos_[
'c:'+key_]
195 xmin=float(
min([i[0]
for i
in pos_.values()]))
196 ymin=float(
min([i[1]
for i
in pos_.values()]))
197 xmax=float(
max([i[0]
for i
in pos_.values()]))
198 ymax=float(
max([i[1]
for i
in pos_.values()]))
206 pos_[i]=[(pos_[i][0]-rootx)/(xmax-xmin)*zoomfact*imx+imx/2,
207 (pos_[i][1]-rooty)/(ymax-ymin)*zoomfact*imy+imy/2]
242 printdestination=
None
280 infotxt=plt.text(0.02,0.92,
"",
281 transform=mainax.transAxes, family=
'monospace',size=10, weight=
'bold',
282 color=navicolor, ha=
'left', va=
'top',zorder=51)
283 seltxt=plt.text(0.,0.,
"",
284 family=
'monospace',size=10, weight=
'bold',
285 color=navicolor, ha=
'left', va=
'center',zorder=51)
291 nxp=root.get_child(
'NetworkXPython')
298 for i
in self.navi.G:
299 if self.navi.G.node[i][
'depth']==-1:
300 self.navi.pos[i]=(-1.3,1.3)
302 if self.navi.G.node[i][
'depth']==0:
303 self.navi.pos[i]=(0.,0.)
305 coord=self.navi.pos[i]
306 magnitude=math.sqrt(coord[0]*coord[0]+coord[1]*coord[1])
310 self.navi.pos[i]=coord
311 draw_edges_nodes(self.navi.G,self.navi.pos,self.navi.se,
'se',self.navi.sn,
'sn',
'solid',signalcolor,10)
312 draw_edges_nodes(self.navi.G,self.navi.pos,self.navi.pe,
'pe',self.navi.pn,
'pn',
'solid',propertycolor,11)
313 draw_edges_nodes(self.navi.G,self.navi.pos,self.navi.fe,
'fe',self.navi.fn,
'fn',
'solid',fieldcolor,12)
314 draw_edges_nodes(self.navi.G,self.navi.pos,self.navi.te,
'te',self.navi.tn,
'tn',
'solid',tagcolor,13)
315 draw_edges_nodes(self.navi.G,self.navi.pos,self.navi.oe,
'oe',self.navi.on,
'on',
'solid',optioncolor,14)
316 draw_edges_nodes(self.navi.G,self.navi.pos,self.navi.le,
'le',self.navi.ln,
'ln',
'dashed',linkcolor,15)
317 draw_edges_nodes(self.navi.G,self.navi.pos,self.navi.ce,
'ce',self.navi.cn,
'cn',
'solid',componentcolor,16)
318 draw_captions(self.navi.G,self.navi.pos,self.navi.scapt,
'sc',signalcolor,40,rotation=self.navi.rot,onlyalign=
True)
319 draw_captions(self.navi.G,self.navi.pos,self.navi.pcapt,
'pc',propertycolor,41,rotation=self.navi.rot,onlyalign=
True)
320 draw_captions(self.navi.G,self.navi.pos,self.navi.fcapt,
'fc',fieldcolor,42,rotation=self.navi.rot,onlyalign=
True)
321 draw_captions(self.navi.G,self.navi.pos,self.navi.tcapt,
'tc',tagcolor,43,rotation=self.navi.rot,onlyalign=
True)
322 draw_captions(self.navi.G,self.navi.pos,self.navi.ocapt,
'oc',optioncolor,44,rotation=self.navi.rot,onlyalign=
True)
323 draw_captions(self.navi.G,self.navi.pos,self.navi.lcapt,
'lc',linkcolor,45,rotation=self.navi.rot,onlyalign=
True)
324 draw_captions(self.navi.G,self.navi.pos,self.navi.ccapt,
'cc',componentcolor,46,rotation=self.navi.rot,onlyalign=
True)
325 naviax.set_xbound((-3,3))
326 naviax.set_ybound((-1.2,1.5))
327 naviax.set_visible(
True)
335 exec event.artist.get_label()
336 if node_info[0]==
"main":
337 exec
"key_orig=self." + node_info[1] +
"[" + str(event.ind[0]) +
"]"
340 exec
"key_orig=self.navi." + node_info[1] +
"[" + str(event.ind[0]) +
"]"
342 key=deepcopy(key_orig)
345 if ((tG.node[key][
'tag']==
'tag')
or (tG.node[key][
'tag']==
'signal')
or (tG.node[key][
'tag']==
'option')
or (tG.node[key][
'tag']==
'field')
or (tG.node[key][
'tag']==
'property')):
346 key=tG.pred[key].keys()[0]
347 comp=root.access_component(key[2:])
349 if node_info[0]==
"navi":
353 self.seltxt.set_text(
"")
354 self.seltxt.set_position(self.
pos[key_orig])
355 if (tG.node[key_orig][
'tag']==
'component'):
356 self.seltxt.set_text(key[2:])
357 if (tG.node[key_orig][
'tag']==
'option'):
358 self.seltxt.set_text(
"option of " + key[2:])
359 if (tG.node[key_orig][
'tag']==
'tag'):
360 self.seltxt.set_text(
"tag of " + key[2:])
361 if (tG.node[key_orig][
'tag']==
'property'):
362 self.seltxt.set_text(
"property of " + key[2:])
363 if (tG.node[key_orig][
'tag']==
'signal'):
364 self.seltxt.set_text(
"signal of " + key[2:])
365 if (tG.node[key_orig][
'tag']==
'field'):
366 self.seltxt.set_text(
"field of " + key[2:])
367 if (tG.node[key_orig][
'tag']==
'link'):
368 self.seltxt.set_text(
"link to " + key[2:])
371 nxp=root.get_child(
'NetworkXPython')
372 infostr=nxp.get_detailed_info(cf.URI(key[2:]))
373 self.infotxt.set_text(
"")
383 def draw_captions(G,pos,capt,label,color,zord,rotation=None,onlyalign=False):
386 capt[i]=
" " + capt[i] +
" "
387 txt=nx.draw_networkx_labels(G,pos,labels=capt,font_color=color)
390 if txt[i]
is not None:
391 txt[i].set_family(
'sans-serif')
393 txt[i].set_weight(
'bold')
394 txt[i].set_zorder(zord)
395 txt[i].set_label(
"caption_info=('" + curraxes.get_label() +
"','" + label +
"')" )
396 txt[i].set_rotation_mode(
'anchor')
397 if rotation
is not None:
398 if (abs(rotation[i])<=90):
399 txt[i].set_verticalalignment(
'center')
400 txt[i].set_horizontalalignment(
'left')
401 if not onlyalign: txt[i].set_rotation(rotation[i])
403 txt[i].set_verticalalignment(
'center')
404 txt[i].set_horizontalalignment(
'right')
405 if not onlyalign: txt[i].set_rotation(rotation[i]+180.)
412 edge=nx.draw_networkx_edges(G,pos,edgelist=elist,edge_color=color,arrows=
False)
413 node=nx.draw_networkx_nodes(G,pos,nodelist=nlist,node_color=color,node_shape=
'o',node_size=50)
415 edge.set_label(
"edge_info=('" + curraxes.get_label() +
"','" + elabel +
"')")
416 edge.set_zorder(zord)
417 edge.set_linewidths(1.5)
418 edge.set_linestyle(edgestyle)
421 node.set_edgecolor(bgcolor)
422 node.set_label(
"node_info=('" + curraxes.get_label() +
"','" + nlabel +
"')")
423 node.set_zorder(zord+10)
424 node.set_linewidths(1.5)
431 for i
in G.successors(key):
437 components=nxp_.get_component_graph( uri = starturi_, depth = depth_ )
438 if depthlimit_sofplt==
True:
439 options=nxp_.get_option_graph( uri = starturi_, depth = depth_ )
440 tags=nxp_.get_tag_graph( uri = starturi_, depth = depth_ )
441 signals=nxp_.get_signal_graph( uri = starturi_, depth = depth_ )
442 fields=nxp_.get_field_graph( uri = starturi_, depth = depth_ )
443 links=nxp_.get_link_graph( uri = starturi_, depth = depth_ )
444 properties=nxp_.get_property_graph( uri = starturi_, depth = depth_ )
446 options=nxp_.get_option_graph( uri = starturi_, depth = depth_-1 )
447 tags=nxp_.get_tag_graph( uri = starturi_, depth = depth_-1 )
448 signals=nxp_.get_signal_graph( uri = starturi_, depth = depth_-1 )
449 fields=nxp_.get_field_graph( uri = starturi_, depth = depth_-1 )
450 links=nxp_.get_link_graph( uri = starturi_, depth = depth_-1 )
451 properties=nxp_.get_property_graph( uri = starturi_, depth = depth_-1 )
463 for line
in StringIO(components): exec
'nec_.' + line
465 for line
in StringIO(options ): exec
'nec_.' + line
467 for line
in StringIO(properties): exec
'nec_.' + line
469 for line
in StringIO(signals ): exec
'nec_.' + line
471 for line
in StringIO(fields ): exec
'nec_.' + line
473 for line
in StringIO(links ): exec
'nec_.' + line
475 for line
in StringIO(tags ): exec
'nec_.' + line
479 parn=[(u)
for (u,d)
in nec_.G.nodes(data=
True)
if d[
'tag']==
'parent']
481 nec_.G.node[i][
'tag']=
'component'
482 pare=[(u,v)
for (u,v,d)
in nec_.G.edges(data=
True)
if d[
'tag']==
'parent']
484 nec_.G.edge[i[0]][i[1]][
'tag']=
'component'
489 if nec_.G.node[i][
'hidden']==
True:
490 if nec_.G.node[i][
'tag'][0]
in hidden:
492 nec_.G.remove_nodes_from(dellist.keys())
493 for i
in dellist.keys():
494 nec_.nodecaption.pop(i)
497 nec_.cn=[(u)
for (u,d)
in nec_.G.nodes(data=
True)
if d[
'tag']==
'component']
498 nec_.ce=[(u,v)
for (u,v,d)
in nec_.G.edges(data=
True)
if d[
'tag']==
'component']
499 nec_.ccapt=dict.fromkeys(nec_.nodecaption,
'')
500 for key
in nec_.cn : nec_.ccapt[key]=nec_.nodecaption[key]
501 nec_.on=[(u)
for (u,d)
in nec_.G.nodes(data=
True)
if d[
'tag']==
'option']
502 nec_.oe=[(u,v)
for (u,v,d)
in nec_.G.edges(data=
True)
if d[
'tag']==
'option']
503 nec_.ocapt=dict.fromkeys(nec_.nodecaption,
'')
504 for key
in nec_.on : nec_.ocapt[key]=nec_.nodecaption[key]
505 nec_.pn=[(u)
for (u,d)
in nec_.G.nodes(data=
True)
if d[
'tag']==
'property']
506 nec_.pe=[(u,v)
for (u,v,d)
in nec_.G.edges(data=
True)
if d[
'tag']==
'property']
507 nec_.pcapt=dict.fromkeys(nec_.nodecaption,
'')
508 for key
in nec_.pn : nec_.pcapt[key]=nec_.nodecaption[key]
509 nec_.sn=[(u)
for (u,d)
in nec_.G.nodes(data=
True)
if d[
'tag']==
'signal']
510 nec_.se=[(u,v)
for (u,v,d)
in nec_.G.edges(data=
True)
if d[
'tag']==
'signal']
511 nec_.scapt=dict.fromkeys(nec_.nodecaption,
'')
512 for key
in nec_.sn : nec_.scapt[key]=nec_.nodecaption[key]
513 nec_.fn=[(u)
for (u,d)
in nec_.G.nodes(data=
True)
if d[
'tag']==
'field']
514 nec_.fe=[(u,v)
for (u,v,d)
in nec_.G.edges(data=
True)
if d[
'tag']==
'field']
515 nec_.fcapt=dict.fromkeys(nec_.nodecaption,
'')
516 for key
in nec_.fn : nec_.fcapt[key]=nec_.nodecaption[key]
517 nec_.ln=[(u)
for (u,d)
in nec_.G.nodes(data=
True)
if d[
'tag']==
'link']
518 nec_.le=[(u,v)
for (u,v,d)
in nec_.G.edges(data=
True)
if d[
'tag']==
'link']
519 nec_.lcapt=dict.fromkeys(nec_.nodecaption,
'')
520 for key
in nec_.ln : nec_.lcapt[key]=nec_.nodecaption[key]
521 nec_.tn=[(u)
for (u,d)
in nec_.G.nodes(data=
True)
if d[
'tag']==
'tag']
522 nec_.te=[(u,v)
for (u,v,d)
in nec_.G.edges(data=
True)
if d[
'tag']==
'tag']
523 nec_.tcapt=dict.fromkeys(nec_.nodecaption,
'')
524 for key
in nec_.tn : nec_.tcapt[key]=nec_.nodecaption[key]
557 def show_graph(starturi,depth=1000,tree='cofl',caption='',printdestination='c',hidden='cospflt'):
560 nxp = root.create_component(
'NetworkXPython',
'cf3.python.NetworkXPython')
564 nec.printdestination=printdestination
566 cid=fig.canvas.mpl_connect(
'pick_event', nec.on_pick)
569 start_key=root.access_component(str(starturi)).
uri().path()
570 titletxt.set_text(
"COOLFluiD3 component graph starting from '" + start_key +
"'")
571 fig.canvas.set_window_title(start_key)
591 print "Statistics for: ", start_key
592 print "Number of nodes & edges"
593 print "--------------------------------"
594 print "Components: %10d%10d" % ( len(nec.cn), len(nec.ce) )
595 print "Options: %10d%10d" % ( len(nec.on), len(nec.oe) )
596 print "Tags: %10d%10d" % ( len(nec.tn), len(nec.te) )
597 print "Properties: %10d%10d" % ( len(nec.pn), len(nec.pe) )
598 print "Signals: %10d%10d" % ( len(nec.sn), len(nec.se) )
599 print "Fields: %10d%10d" % ( len(nec.fn), len(nec.fe) )
600 print "Links: %10d%10d" % ( len(nec.ln), len(nec.le) )
601 print "TOTAL: %10d%10d" % ( len(nec.G.nodes()), len(nec.G.edges()) )
604 if 's' in tree:
draw_edges_nodes(nec.G,nec.pos,nec.se,
'se',nec.sn,
'sn',
'solid',signalcolor,10)
605 if 'p' in tree:
draw_edges_nodes(nec.G,nec.pos,nec.pe,
'pe',nec.pn,
'pn',
'solid',propertycolor,11)
606 if 'f' in tree:
draw_edges_nodes(nec.G,nec.pos,nec.fe,
'fe',nec.fn,
'fn',
'solid',fieldcolor,12)
607 if 't' in tree:
draw_edges_nodes(nec.G,nec.pos,nec.te,
'te',nec.tn,
'tn',
'solid',tagcolor,13)
608 if 'o' in tree:
draw_edges_nodes(nec.G,nec.pos,nec.oe,
'oe',nec.on,
'on',
'solid',optioncolor,14)
609 if 'l' in tree:
draw_edges_nodes(nec.G,nec.pos,nec.le,
'le',nec.ln,
'ln',
'dashed',linkcolor,15)
610 if 'c' in tree:
draw_edges_nodes(nec.G,nec.pos,nec.ce,
'ce',nec.cn,
'cn',
'solid',componentcolor,16)
613 if 's' in caption:
draw_captions(nec.G,nec.pos,nec.scapt,
'sc',signalcolor,40,rotation=rot)
614 if 'p' in caption:
draw_captions(nec.G,nec.pos,nec.pcapt,
'pc',propertycolor,41,rotation=rot)
615 if 'f' in caption:
draw_captions(nec.G,nec.pos,nec.fcapt,
'fc',fieldcolor,42,rotation=rot)
616 if 't' in caption:
draw_captions(nec.G,nec.pos,nec.tcapt,
'tc',tagcolor,43,rotation=rot)
617 if 'o' in caption:
draw_captions(nec.G,nec.pos,nec.ocapt,
'oc',optioncolor,44,rotation=rot)
618 if 'l' in caption:
draw_captions(nec.G,nec.pos,nec.lcapt,
'lc',linkcolor,45,rotation=rot)
619 if 'c' in caption:
draw_captions(nec.G,nec.pos,nec.ccapt,
'cc',componentcolor,46,rotation=rot)
622 print "---------- SHOW ----------"
need to put things into a class to be reachable by the event callbacks
def show_graph
starturi: from where the recursive listing starts depth: how many levels to list down deep in startur...
def traditional_left2right_tree_layout_in_polar(G, key)
def plot_secondary_navigation(self, key)
common::URI uri(ComponentWrapper &self)
Real max(const Real a, const Real b)
Maximum between two scalars.
def append_with_successors_recursive(G, key, to_append)
query data from coolfluid and build graph and lists
def build_graph_with_lists
def traverse_successors_recursive(G, key, pos, y)
custom-made layouts traditional_left2right_tree_layout(G,key,pos) traditional_left2right_tree_layout_...
def draw_edges_nodes(G, pos, elist, elabel, nlist, nlabel, edgestyle, color, zord)
draw edges and nodes
def normalize_coordinates(key_, pos_, img_)
renormalizing positions in the range of zoomfact & root position in zoomfact it gets normalized in a way ...
def __init__(self, name_)
Real min(const Real a, const Real b)
Minimum between two scalars.
def compute_edge_angles_for_target_nodes(G, pos)
compute angle in degree for each node at which the edge from parent node arrives
def traditional_left2right_tree_layout(G, key)