documentationfor yFiles for HTML 3.0.0.3

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

Constructors

Properties

Methods