Tulip supports graphs hierarchies: go to
Graph Editor →
hierarchy 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:
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 →
Create Subgraph, (or Ctrl + Shift + G).
The subgraph appears in the hierarchy tab.
right-click → create group. (If a warning "Grouping can't be done on the root graph, a subgraph will be created" appears, just click
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.
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).
Those algorithms are in menu