forked from Yanivmd/TRACY
-
Notifications
You must be signed in to change notification settings - Fork 2
/
IgraphHelper.py
34 lines (26 loc) · 1.09 KB
/
IgraphHelper.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
functionsGraphsDirectoryName = "funcgraphs"
graphAttribPrefix = "GRAPH"
# this will copy the graph attributes to the first vertex to bypass the bug with loading graph attributes
def copyGraphAtributesToRoot(g):
#RLS!! #print g.attributes()
cleanUpGraph(g)
#for v in g.vs: # cleanUpObject(v) #END OF RLS
def copyIgraphObjectAttributes(srcObj,dstObj,excludeList):
for attrib in srcObj.attributes():
if excludeList != None and excludeList.count(attrib) == 0:
dstObj[attrib] = srcObj[attrib]
def copyGraphAtributesFromRoot(g):
for attrib in g.vs[0].attributes():
#pass
#print str(attrib) + str(g[attrib])
if (attrib.find(graphAttribPrefix)==0):
g[attrib.replace(graphAttribPrefix,'')] = g.vs[0][attrib]
g.vs[0][attrib] = None
del g.vs[0][attrib]
#del g[attrib]
# this will remove all the things we dont need from the graph..(so they could be garbge collected)
def cleanUpGraph(obj):
obj['presentCode']=""
del obj['presentCode']
obj['originalCode'] = ""
del obj['originalCode']