documentationfor yFiles for HTML 2.6

Intersections

Finds all intersections between nodes, edges and labels.

Inheritance Hierarchy
Intersections

Remarks

It provides means to limit the algorithm to a specific graph subset or to only consider certain item types or specific items.

The IntersectionsResult computed by this algorithm contains pairwise intersections, i.e. each Intersection object is an intersection/overlap between two graph items.

Note that if two elements "touch" in a single coordinate, this is considered as an intersection as well. For example, two nodes directly next to each other where the right border of the left node is on the same coordinate as the left border of the right node. The Intersection, in consequence, contains only two points. Testing for the number of points is a way to manually filter and ignore these kind of intersection results.

Examples

Finding and highlighting the edges that intersect with some other item
// run intersection algorithm with default settings
const result = new Intersections().run(graph)

// highlight the edges involved in an intersection by setting a distinct edge style for them
// (other graph items could be highlighted as well)
for (const intersection of result.intersections) {
  if (intersection.item1 instanceof IEdge) {
    graph.setStyle(intersection.item1, highlightEdgeStyle)
  }
  if (intersection.item2 instanceof IEdge) {
    graph.setStyle(intersection.item2, highlightEdgeStyle)
  }
}

Type Details

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

See Also

By default, the algorithm considers the shape geometry of a node and the path geometry of an edge. If only rectangular bounds for nodes and line segments for edges should be used, disable considerItemGeometry.

Constructors

Properties

Methods