Class TriangleSubgraph

All Implemented Interfaces:
EntityLayout, SubgraphLayout

public class TriangleSubgraph extends FigureSubgraph
A subgraph that is visualized in a graph as a triangle. It assumes that nodes in context that uses them are arranged in a tree structure and the nodes added to the subgraph are a subtree (except for the subtree's root, which should not be added). The triangle has three features that show the properties of a subtree contained within it:
  • Height of the triangle is proportional to the height of the subtree. If the subtree contains the whole tree, the triangle's height will be equal to value provided with TriangleSubgraph.TriangleParameters.referenceHeight (default is 50).
  • Length of the triangle's base depends on the number of leaves in the subtree. More precisely, it is proportional to the logarithm of the percent that the subtree's leaves make of the whole context's leaves. The proportion factor is adjusted so that for a subtree containing all the leaves the base has length provided with TriangleSubgraph TriangleSubgraph.TriangleParameters.referenceBase (default is 50) and for a subtree containing only one leaf the base has length 1.
  • Background color of the triangle depends on average number of children for nodes in the subtree. The less is this value, the more bright is the color (up to white for a subtree with average number of children equal to 1). The average value is calculated only for nodes that have at least one child. The root of the subtree (which is not directly added to this subgraph) is also accounted.
When the first subgraph of this class is created for a layout context, a TreeLayoutObserver is created for the context. It must keep track of changes in the graph structure, so events related to it should not be intercepted by other listeners before they reach the subgraph's observer.
Since:
1.14