[VTK ARB] Dependency generations and visualisation

Andrew Maclean a.maclean at cas.edu.au
Wed Aug 18 22:31:02 EDT 2010


Hey Bill, need some python practice?

This could be useful in looking at the examples.

I attach a python script taken from
http://furius.ca/pubcode/pub/conf/common/bin/depends-dot.html
And modified so that just the executable and the VTK nodes of the graph
are traversed.

Run it as:
python depends-dot ./Executable_File > depends.dot
Then:
neato -Tps -O depends.dot
Or:
dot -Tps -O depends.dot

As you know you can also run:
cmake --graphviz=g.dot ..
Assuming the source is in ..
Then:
neato -Tps -O g.dot
Or:
dot -Tps -O g.dot

However the python script (as modified) displays a lot more information.
My modifications are:
            # Eliminate /usr or /lib libraries and keep the first level
VTK links.
	    #if fn.find('/usr') == -1 and fn.find('/lib') == -1 and
dfn.find('VTK') != -1:
            # Just the executable and the VTK nodes of the graph are
traversed.
	    if dfn.find('VTK') != -1:
               print '"%s" -> "%s";' % (fn, dfn)

Just uncomment the first if statement to just get the first-level
linkages to libraries.

This might be a good start in visualising dependencies.

I also found  perl script called cinclude2dot that  produces an include
dependency graph see: http://www.flourish.org/cinclude2dot/ . The
problem with this one is that it cannot follow links to includes in
other directories. My perl is not good enough but it may be possible to
parse CMakeCache.txt to pick up the include paths and traverse those
directories too.
I ran this on the vtk directory and the output is ... well ...
spectacular and unreadable.
Try:
./cinclude2dot --merge module > source.dot


The python script focuses on libraries and the perl one focuses on
includes. So the approaches are different. However I feel the perl one
could be more useful with the --merge module option since in general vtk
include names reflect class names.

Regards
   Andrew


-- 
___________________________________________
Andrew J. P. Maclean
Centre for Autonomous Systems
The Rose Street Building J04
The University of Sydney  2006  NSW
AUSTRALIA
Ph: +61 2 9351 3283
Fax: +61 2 9351 7474
URL: http://www.acfr.usyd.edu.au/
___________________________________________
-------------- next part --------------
A non-text attachment was scrubbed...
Name: depends-dot
Type: text/x-python
Size: 2096 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/arb/attachments/20100819/9f8200f7/attachment-0002.py>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cinclude2dot
Type: application/x-perl
Size: 8192 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/arb/attachments/20100819/9f8200f7/attachment-0002.bin>


More information about the Arb mailing list