def build_function_graph(self, analysis_unit_dict):
''' BUILDS DIRECTED FUNCTION GRAPH
input: a dictionary of functions from this dump file
output: none. Side effect creates a graph linked to this object
'''
if self.debug_verbose:
print inspect.stack()[0][3]
# BUILD CALL GRAPH
self.function_graph = nx.DiGraph()
G = self.function_graph
for k, function_dict in analysis_unit_dict.iteritems():
if function_dict['function']: # MIGHT BE NONE WHEN FUNCTION IS CLASS CONSTRUCTOR (?)
node = function_dict['function'].Id # Id of the Function
#if not G.has_node(node):
G.add_node(node) #, function_dict_key=k}) # FUNCTION CPP OBJECT IS NODE
#else:
all_attr = nx.get_node_attributes(G, 'function_id')
all_attr[node] = k
nx.set_node_attributes(G, 'function_id', all_attr)
#function_dict['is_visited'] = False
self.add_edges_to_function_graph(function_dict, G, node)
self.function_graph = G
评论列表
文章目录