GraphML Representation of Nested Graph Structures
Questions & AnswersSummary
Description
The GraphML file format defines nested graphs in the context of their enclosing nodes: a subgraph is listed as the content of the GraphML <node>
element that contains the subgraph.
The GraphML representation for a graph that has a subgraph nested within a subgraph, for example, looks something like the one shown below.
The recursive nesting of the subgraphs can be observed from the <graph>
elements within <node>
elements.
<?xml version="1.0" encoding="UTF-8"?>
<graphml>
<graph id="G" edgedefault="directed">
<node id="n0"/>
<node id="n1"/>
<node id="n2">
<graph id="n2::" edgedefault="directed">
<node id="n2::n0"/>
<node id="n2::n1">
<graph id="n2::n1::" edgedefault="directed">
<node id="n2::n1::n0"/>
<node id="n2::n1::n1"/>
<node id="n2::n1::n2"/>
<edge id="e0" source="n2::n1::n1" target="n2::n1::n0"/>
<edge id="e1" source="n2::n1::n2" target="n2::n1::n1"/>
</graph>
</node>
<node id="n2::n2"/>
<edge id="e2" source="n2::n1" target="n2::n0"/>
<edge id="e3" source="n2::n2" target="n2::n1"/>
</graph>
</node>
<edge id="e4" source="n1" target="n0"/>
<edge id="e5" source="n1" target="n2::n1"/>
<edge id="e6" source="n0" target="n2"/>
</graph>
</graphml>
For the sake of clearer presentation the above GraphML file is "structure-only," i.e., it lacks the yFiles node and edge realizer definitions which are responsible for the actual graphical representation of nodes and edges.
The resources below include GraphML files that show both the structure-only representation as well as the full-fledged representation with the complete graphical information for the realizers.