3

Is it possible to obtain a node and edge count for the IDA Pro graph overview? I'm able to obtain this if I generate a wingraph32 flowchart, but it seems that wingraph32 doesn't work for very large functions. Is there also a way for wingraph32 to support very large graphs?

Thanks.

4

If you want to get a node and edge count for a function's graph in IDA, you can calculate it with the given IDAPython code:

func = idaapi.get_func(here())
g = idaapi.FlowChart(func)

nodes = 0
edges = 0
for x in g:
  nodes += 1
  for succ in x.succs():
    edges += 1

  for pred in x.preds():
    edges += 1

print "Number of nodes", nodes
print "Number of edges", edges

As for the wingraph32 tool, I recommend you to use the "Proximity Viewer" instead. Just press the key "-" when the cursor is inside a function.

  • Hi, thanks for the code. It produces the correct number of nodes, but the edge count seems to be incorrect when compared to the that produced by wingraph32. Why do you recommend Proximity Viewer though? It doesn't seem to give me the CFG. – user1118764 Jun 4 '18 at 0:50
  • I went back to reran your code on smaller graphs so I can actually count the number of segments and compare it to what Flowchart was giving me. It seems your output is correct, while Flowchart is giving me a way higher edge count (even 1 edge is reported as 2 edge). Flowchart does count "edge segments" though, is this different from number of edges? – user1118764 Jun 4 '18 at 0:57
  • IIRC, the FlowChart will take into account function chunks. Perhaps @igorsk knows better. – joxeankoret Jun 4 '18 at 7:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.