documentationfor yFiles for HTML 2.6

PenaltySettings

This class provides the cost penalties that are applied for violating restrictions during a PathSearch.

Inheritance Hierarchy
PenaltySettings

Remarks

The PathSearch calculates the shortest path from the source to the target, where shortest path means the path with the lowest costs. Costs result from violations of restrictions that are defined by the different PathSearchExtensions. This class defines penalties for the various violations. The PathSearch can be adapted to specific needs by varying these penalties. In order to avoid a certain violation, the appropriate penalty must be increased.

There are some predefined penalty settings which set a different focus for the path search: OPTIMIZATION_BALANCED, OPTIMIZATION_EDGE_BENDS, OPTIMIZATION_EDGE_LENGTHS and OPTIMIZATION_EDGE_CROSSINGS.

Default Values of Properties

adjacentEdgeCrossingPenalty7
bendPenalty3
bendsInNodeToEdgeDistancePenalty10
edgeCrossingPenalty1
edgeLabelCrossingPenalty13
edgeLengthPenalty2
groupNodeCrossingPenalty60
invalidEdgeGroupingPenalty25
minimumEdgeToEdgeDistancePenalty5
minimumFirstLastSegmentLengthPenalty12
minimumGroupNodeToEdgeDistancePenalty10
minimumNodeCornerDistancePenalty6
minimumNodeToEdgeDistancePenalty10
monotonyViolationPenalty14
nodeCrossingPenalty3000
nodeLabelCrossingPenalty13
partitionGridCellReentrancePenalty7
portCrossingPenalty13
portViolationPenalty10000
sketchViolationPenalty4.5

Type Details

yfiles module
layout-core
yfiles-umd modules
All layout modules, view-layout-bridge
Legacy UMD name
yfiles.router.PenaltySettings

See Also

The penalties are not independent. They will all influence the PathSearch together. Therefore, changing a certain penalty might not always lead to the desired effect for specific edges.
High values for the penalties may seem like a great idea to avoid certain conditions, but can cause all kinds of side effects and significantly increase the runtime when it is hard or even impossible to satisfy the condition. Thus, we recommend keeping the values in the range between 0 and 10000. It is especially discouraged to use maximum values like Number.MAX_VALUE as they easily lead to overflows and routing artifacts.

Constructors

Properties

Methods

Constants