Skip to content

Given a python module as the argument, the following python module generates a dependency graph for the module. The graphml file thus generated can be used for visualization. On using "aggregated_depgraph.py", the dependencies are built in a cumulative fashion.

Notifications You must be signed in to change notification settings

vijeshm/pythondependencygraph

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

usage: python depgraph.py module_name output: a .graphml file

##The Python Module Network

networkx module

dependencies between commonly used modules

nltk module

numpy module

simplecv module

urllib2 module

Importing a module in Python! Hmmm.. one of the easiest tasks around, eh? Not so fast, whats going on back there? Is the module importing any other module in turn? Well, sometimes yeah. This behavior propagates through a chain of imports. And whats the best way to model the scenario? Thats right, you guessed it! A Graph. A directed one to be more precise.

Well, what if I somehow magically gave you the import graph to play with? What'll you do with it?

  • For starters, you could use it to find the number of modules that a particular module is dependent on. Its just the outdegree of the module node.
  • Next, you could find how two modules are related (or even find out if they are even related at all). Thats easy, just find out a path from source to destination. Simple, isnt it?
  • Ok, lets get a bit more serious. Wouldnt you want to find out the hotshots of the modules? No? Oh cmon. Its simple you see, the node with the highest number of paths ending with that node is numero uno hotshot, and the pattern follows.
  • Now, more serious stuff coming up. Buckle up! Ever wondered what the most "important" import would be? Technically speaking, this would be the edge with the highest betweenness centrality.

Given a dependency graph, you'd be able to deduce all these cool stuff just with the right tools and a few mouse clicks. So, what are you waiting for? start generating those graphs.

About

Given a python module as the argument, the following python module generates a dependency graph for the module. The graphml file thus generated can be used for visualization. On using "aggregated_depgraph.py", the dependencies are built in a cumulative fashion.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages