Skip to content

tum-i4/CodeMapExtractor

Repository files navigation

CodeMapExtractor

About

CodeMapExtractor is a simple tool to extract graph from dgml file. dgml is the file extension of CodeMap generated by Visual Studio which is a special kind of XML. CodeMapExtractor is capable of extracting function call graph beyond classes and namespace provided that a correct dgml file is given.

For Further Development

CodeMapExtractor stores the call graph of whole project as a adjacency matrix and a networkx object. You can do any experiment on the adjacency matrix. networkx is rich in graph algorithm, most of the famous graph algorithm like BFS, DFS, Floyd-Warshall, Dijkstra etc algorithm can be invoked with a single line change.

How to Generate dgml file

Step 1: Open a Visual Studio project

Step 2: Right Click on the Project Name on the Solution Explorer

Step 3: Click on '''Show on CodeMap'''

Step 4: After any graphical object with project name is visible, expand all the nodes recursively by clicking on the expand icon of each graphical unit

Step 5: When all the graphical nodes are expanded, Press Ctrl+S or Save using file menu. It will take you to file save dialog where you will see the file to be saved is a dgml file. Save it and feed it to the python script

For Further Experiment

The ADJ_MATRIX variable of CodeMapExtractor class hold the adjacency matrix of the given dgml file

The G variable of CodeMapExtractor class is a graph of all function calls available in the dgml file. G is a networkx.DiGraph object. Most common graph algorithm can be directly called upon it. For example, to get the callee graph I have run depth first search with limit on G.

To extend the work with networkx

Visit networkx documentation :octocat:

Some Graphs generated by CodeMapExtractor on Aletheia Project

Caller Graph

Callee Graph

Call Graph

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages