documentationfor yFiles for HTML 2.6

SubgraphLayoutData

Specifies custom data for the SubgraphLayout.

Inheritance Hierarchy
LayoutData
SubgraphLayoutData

Examples

The following example shows how to create a new instance of this class and use it in conjunction with a MultiStageLayout that has a SubgraphLayout already in its pipeline:

Enabling the SubgraphLayout and configuring it using the layout data
const hierarchicLayout = new HierarchicLayout({ subgraphLayoutEnabled: true })
const subgraphLayoutData = new SubgraphLayoutData()

//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 SubgraphLayout and its SubgraphLayoutData can be used as a stage with any other layout algorithm:

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

//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 Details

yfiles module
view-layout-bridge
yfiles-umd modules
view-layout-bridge
Legacy UMD name
yfiles.layout.SubgraphLayoutData

Constructors

Properties

Methods