MCPcopy Index your code
hub / github.com/Persper/code-analytics / build_call_graph

Function build_call_graph

dev_analysis.py:32–48  ·  view source on GitHub ↗
(xml_dir)

Source from the content-addressed store, hash-verified

30# Prepare the call graph
31
32def build_call_graph(xml_dir):
33 print('Building the call graph for ' + xml_dir)
34
35 graph = nx.DiGraph()
36 func2file = {}
37
38 for xml in glob.glob(xml_dir + '/**/*.[ch].xml', recursive=True):
39 tree = etree.parse(xml)
40 roots = [tree.getroot()]
41 _, _, f2f = call_graph.c.build_call_graph(roots, G=graph)
42 for func, fname in f2f.items():
43 func2file[func] = fname
44 print("Number of nodes: {}".format(len(graph.nodes())))
45 print("Number of edges: {}".format(len(graph.edges())))
46 n = nx.number_weakly_connected_components(graph)
47 print("Number of connected components: {}".format(n))
48 return graph, func2file
49
50def pagerank_c(graph, alpha_low, alpha_high, alpha_step):
51 pra = []

Callers 1

mainFunction · 0.85

Calls 4

itemsMethod · 0.80
nodesMethod · 0.80
edgesMethod · 0.80
parseMethod · 0.45

Tested by

no test coverage detected