documentationfor yFiles for HTML 3.0.0.2

LayoutGraph

Represents a directed graph structure that contains layout information for its elements and to which layout algorithms (ILayoutAlgorithm) can be applied.

Inheritance Hierarchy
LayoutGraph

Remarks

A directed graph consists of a collection of "nodes" (represented by instances of LayoutNode) and "edges" (represented by instances of LayoutEdge) that connect pairs of nodes.

By default, the LayoutGraph contains layout information, such as the position and size of nodes (layout), and edge paths (pathPoints). Therefore, a LayoutGraph instance typically represents a visual drawing of a graph. If layout information is unnecessary, a more lightweight graph instance can be created using createStructureGraph, which only maintains the graph's structure without layout or labels. This is useful for performance-critical scenarios where only structural algorithms like shortestPath or pageRank are applied.

The class supports operations such as node and edge creation, deletion, access, and iteration through properties like nodes and edges. Additionally, nodes and edges can have associated labels, accessible via nodeLabels and edgeLabels.

Structural changes to the graph (such as adding or removing nodes/edges) must be made through the LayoutGraph instance, ensuring consistent graph manipulation.

In addition to basic node and edge management, the LayoutGraph supports the hierarchical grouping of nodes. Nodes can be designated as group nodes, which can contain other nodes, including other group nodes, forming a hierarchical structure. Methods such as createGroupNode, setParent, and setIsGroupNode allow the creation and manipulation of such groups.

Group nodes are useful for organizing complex graph structures, where nodes can be logically grouped together. The grouping hierarchy can be queried using methods like getChildren and getParent, enabling navigation and management of the nested structure. This functionality is particularly helpful in scenarios where visual grouping or compartmentalization of nodes is required.

Data access and manipulation are also supported via IMapper<K,V>, allowing custom data to be associated with nodes and edges.

Type Details

yFiles module
algorithms

See Also

Constructors

Properties

Methods

Static Methods