Include topic hierarchy into your dot graphs

Problem

You are using DirectedGraphPlugin and would like to include part of the parent-child topic hierarchy into your graphs. You have examined DirectedGraphWebMapPlugin and have determined that it doesn't meet your needs.

Context

You have information stored in your structured wiki over many topics arranged into a logical hierarchy by setting the topic parents appropriately.

You are using DirectedGraphPlugin to do visualisation of some or all of this information and would like to avoid hand-writing dot graph code that would be a duplicate of the natural topic hierarchy that is already in place.

Solution

Create a topic (for example's sake, Main.TopicTree2Dot) with the following:

%DBRECURSE{"%QTOPIC%"
   web="%QWEB%"
   header="\"%QTOPIC%\" [URL=\"%SCRIPTURLPATH{view}%/%QWEB%/%QTOPIC%\"];$n$n"
   format="\"$expand(parent)\" -> \"$topic\";$n$n\"$topic\" [URL=\"%SCRIPTURLPATH{"view"}%/%QWEB%/$topic\"];$n"
}%

You can then include this topic with the appropriate parameters in the middle of your dot code, for example:
<dot map="on" vectorformats="svg jpg">
digraph G {
  rankdir=LR;
  %INCLUDE{"Main.TopicTree2Dot" QWEB="SomeWeb" QTOPIC="TopicParentWithChildren"}%
}
</dot>

Known Uses

Known Limitations

See Also

-- PaulHarvey - 29 Sep 2009

BestPracticeTipsForm edit

Category Using Extensions
Topic revision: r4 - 05 Dec 2009, PaulHarvey - This page was cached on 17 Nov 2018 - 19:58.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy