[VTK ARB] Dependency generations and visualisation

Jeff Baumes jeff.baumes at kitware.com
Thu Aug 19 11:43:40 EDT 2010


I attempted some custom scripts to see the include structure of VTK.

python depends.py > vtkdepends.txt
vtkpython dependsview.py vtkdepends.txt

The first will create a two-column list of all includes from one class to
another in VTK and must be called from the root of VTK source. The second
visualizes the data with VTK itself and prints out the classes with the
highest number of connections. Since the network makes a so-called
"hairball", the second script optionally takes a maximum linkage cutoff to
simplify the graph, e.g.

vtkpython dependsview.py vtkdepends.txt 10

will remove any classes with more than 10 links. Nodes are colored by number
of connections.

Jeff

On Wed, Aug 18, 2010 at 10:31 PM, Andrew Maclean <a.maclean at cas.edu.au>wrote:

> 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/
> ___________________________________________
>
> _______________________________________________
> Arb mailing list
> Arb at vtk.org
> http://public.kitware.com/cgi-bin/mailman/listinfo/arb
>
>


-- 
Jeff Baumes, Ph.D.
Technical Lead, Kitware Inc.
(518) 881-4932
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/arb/attachments/20100819/c48a5140/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: depends.py
Type: application/octet-stream
Size: 899 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/arb/attachments/20100819/c48a5140/attachment-0004.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dependsview.py
Type: application/octet-stream
Size: 1605 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/arb/attachments/20100819/c48a5140/attachment-0005.obj>


More information about the Arb mailing list