documentationfor yFiles for HTML 3.0.0.3

SubgraphLayoutStageData<TNode,TEdge,TNodeLabel,TEdgeLabel>

Specifies custom data for the SubgraphLayoutStage.

Inheritance Hierarchy

Examples

The following example shows how to create a new instance of this class and use it in conjunction with an ILayoutAlgorithm that has a SubgraphLayoutStage already in its LayoutStageStack:

Enabling the SubgraphLayoutStage and configuring it using the layout data
const hierarchicLayout = new HierarchicalLayout()
hierarchicLayout.layoutStages.get(SubgraphLayoutStage)!.enabled = true

const subgraphLayoutData = new SubgraphLayoutStageData()

//only nodes that have at least one adjacent edge are included and visible for the hierarchic layout
subgraphLayoutData.subgraphNodes = (node) => graph.degree(node) > 0

graphComponent.graph.applyLayout(hierarchicLayout, subgraphLayoutData)

The SubgraphLayoutStage and its SubgraphLayoutStageData<TNode,TEdge,TNodeLabel,TEdgeLabel> can be used as a stage with any other layout algorithm:

Using SubgraphLayoutStage to exclude specific edges from edge routing
//create an edge routing algorithm wrapped by a subgraph layout stage
const layout = new SubgraphLayoutStage(new EdgeRouter())
const layoutData = new SubgraphLayoutStageData()

//exclude edges that are a self-loop -> will not be visible for the core layout (EdgeRouter in this example)
layoutData.subgraphEdges.excludes = (edge) => edge.isSelfLoop

graphComponent.graph.applyLayout(layout, layoutData)

Type Parameters

TNode
TEdge
TNodeLabel
TEdgeLabel

Type Details

yFiles module
algorithms

Constructors

Properties

Methods