3. Hierarchy

Tulip supports graphs hierarchies: go to Graph Editorhierarchy to view the tree of subgraphs. Click on the tree to view the corresponding subgraph.


Here is an example graph (it is the Orion constellation). Disregard the thick fading edges for now.


A subgraph is simply a subset of the graph elements: some nodes of the graph, and some edges between them (more information: Wikipedia: Subgraphs).

Specifically, an edge of a subgraph must already be present in the original graph. A subgraph does not necessarily contains all the edges of the induced subgraph. For an edge to be in the subgraph, both its endpoints must be in the subgraph.

For instance, here is a subgraph consisting in nodes 3 to 7 (but not all edges between them):

Subgraphs can be nested. Here are two subgraphs included in subgraph 1:

(and this is Orion's belt):


To better view the hierarchy, a subgraph can be represented as a single node, called a meta-node. A meta-node is always associated to exactly one subgraph. Here is the belt, represented as on single node (node with id 9) in a larger subgraph consisting of nodes 0 to 5:

This subgraph (with id 8) is it itself represented as one single node in the complete graph:

Note the thick fading edges: they go from one small red node to a large white meta-node. They are thus thin red to thick white.


A meta-graph is a graph that contains meta-nodes. The "group" subgraph is a nice representation of the hierarchy:

Each time a meta-node is created, it is added to the subgraph "groups" (which is created it with all nodes if it does not exists) and all nodes of the meta-node are removed from the "group" subgraph. Here, "groups" contains nodes 6,7 and 8. Meta-node 8 contains nodes 0,1,2 and 9. And meta-node 9 contains nodes 3,4 and 5.

On the other hand, the root graph represents all nodes and all meta-nodes (each meta-node has a representation of its subgraph inside it), and thus can be a bit messy:

Creating subgraphs or meta-nodes

Creating a subgraph

To create a subgraph:

  • Select a few Nodes with the selection tool. (Shift + click, will add a node to the selection) Optionally, select all edges between the selected nodes with the "Induced Sub-graph" algorithm.

  • Click menu → EditCreate Subgraph, (or Ctrl + Shift + G).

The subgraph appears in the hierarchy tab.

Creating a meta-node

To create a meta-node, select the desired nodes then right-click → create group. (If a warning "Grouping can't be done on the root graph, a subgraph will be created" appears, just click OK.) Create metanode means:
  • create a subgraph with the selected elements. This subgraph is called grp_00042 (or any other number)
  • create a meta-node in the current subgraph (unless it is the root graph) and associate both (i.e. the newly created subgraph and meta-node)

Removing / ungrouping a subgraph or meta-node

Right-click a subgraph or meta-node to remove or ungroup it.

Deleting a meta-node deletes all nodes in this meta-node, but not the meta-node. The meta-node still has a representation of its (empty) subgraph inside it, it is thus an empty ellipse.

When ungrouping a meta-node, all the layouts properties of the meta-node's nodes are moved to the root graph. The subgraphs created with the meta-node are not deleted.

Removing a subgraph has no effects on the root graph.

Modifying subgraphs or meta-nodes


If you move nodes within a subgraph (with the mouse or through a layout algorithm), the same node will be moved in the root graph.

If you use a measure algorithm on a subgraph, new local properties are created. Those properties are not applied to the root graph (if properties are not defined on the subgraph, they are inherited).

Algorithms that create subgraphs

Those algorithms are in menu AlgorithmGeneral.