documentationfor yFiles for HTML 2.6

Neighborhood

Finds the direct or indirect neighbors of a given set of nodes.

Inheritance Hierarchy
Neighborhood

Remarks

  • A direct neighbor of a node is directly connected by an edge to that node.
  • An indirect neighbor of a node is directly connected to another direct or indirect neighbor of a node.
The order of the returned nodes is determined by a breadth-first search. No start node will be part of the resulting set.

Examples

// set up the algorithm to find both predecessors and successors
const algorithm = new Neighborhood({
  maximumDistance: 2,
  traversalDirection: TraversalDirection.BOTH
})
// run the algorithm
const result = algorithm.run(graph)

// highlight the neighbors
for (const node of result.neighbors) {
  graph.setStyle(node, highlightNodeStyle)
}

Type Details

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

See Also

Constructors

Properties

Methods