C

LabelingCosts

Provides costs that influence the GenericLabeling algorithm during the ranking of different label positions.
Inheritance Hierarchy

Remarks

The GenericLabeling algorithm chooses from a set of valid label positions (specified by EdgeLabelCandidates and NodeLabelCandidates, respectively). The LabelingCosts allow specifying preferences on the costs for different types of positions. For example, whether a position where a label crosses an edge should have a high cost and, thus, is less likely chosen by the algorithm (see edgeOverlapCost).

Besides specifying custom LabelingCosts, this class contains several predefined cost configurations that realize different optimization strategies.

Default Values of Properties

NameDefault
ambiguousPlacementCost0.0
customPreferenceViolationCost1.0
edgeOverlapCost1.0
labelOverlapCost1.0
layoutGridViolationCost1.0
nodeOverlapCost1.0
preferredPlacementViolationCost1.0

See Also

API

defaultNodeLabelingCosts, defaultEdgeLabelingCosts

Members

No filters for this type

Constructors

Creates a new LabelingCosts instance with default settings.
Creates a new LabelingCosts instance, whose cost values are based on the specified LabelingOptimizationStrategy.

Parameters

optimizationStrategy: LabelingOptimizationStrategy
a cost configuration that optimizes for a particular layout quality.

Properties

Specifies the cost for a label position that is ambiguous with respect to its associated owner element.
A label position is considered to be ambiguous if it might not be possible to identify to which graph element the label belongs. For example, an edge label placed in between two edges is ambiguous.
Applying ambiguity reduction may significantly increase the running time of the labeling algorithm, especially for graphs with a large number of labels and or a high number of LabelCandidates.
final

Default Value

The default value is: 0.0
Specifies the cost for a label position that violates the custom preference specified by weight.

If the specified cost is high, label positions with a higher custom preference/weight are more likely chosen by the labeling algorithm. There are multiple ways to specify the weight values, e.g., as a parameter of a predefined candidate set (see addDiscreteCandidates) or by means of property edge label candidate processor or node label candidate processor respectively.

The cost should be a factor between 0 and 1, where 0 means that a violation is considered unimportant and 1 means that an overlap is considered severe.

final

Throws

Exception ({ name: 'ArgumentError' })
if the specified value is outside of [0,1]

Default Value

The default value is: 1.0
Specifies the cost for a label position that overlaps with an edge.
The cost should be a factor between 0 and 1, where 0 means that an overlap is considered unimportant and 1 means that an overlap is considered severe.
final

Throws

Exception ({ name: 'ArgumentError' })
if the specified value is outside of [0,1]

Default Value

The default value is: 1.0
Specifies the cost for a label position that overlaps with another label.
The cost should be a factor between 0 and 1, where 0 means that an overlap is considered unimportant and 1 means that an overlap is considered severe.
final

Throws

Exception ({ name: 'ArgumentError' })
if the specified value is outside of [0,1]

Default Value

The default value is: 1.0
Specifies the cost for a label position that violates the LayoutGrid.

The cost should be a factor between 0 and 1, where 0 means that a violation is considered unimportant and 1 means that a violation is considered severe.

A label is considered to be violating the layout grid if it is overlapping either the grid lines or, to a lesser extent, the specified padding from those lines. Additionally, this cost applies to placements that lie completely outside the grid bounds.

final

Throws

Exception ({ name: 'ArgumentError' })
if the specified value is outside of [0,1]

Default Value

The default value is: 1.0
Specifies the cost for a label position that overlaps the box of a node.
The cost should be a factor between 0 and 1, where 0 means that an overlap is considered unimportant and 1 means that an overlap is considered severe.
final

Throws

Exception ({ name: 'ArgumentError' })
if the specified value is outside of [0,1]

Default Value

The default value is: 1.0
Specifies the cost for a label position that violates the associated EdgeLabelPreferredPlacement.

The cost should be a factor between 0 and 1, where 0 means that a violation is considered unimportant and 1 means that an overlap is considered severe.

As EdgeLabelPreferredPlacements only apply to edge labels, this cost has no effect on candidates for node labels.

final

Throws

Exception ({ name: 'ArgumentError' })
if the specified value is outside of [0,1]

Default Value

The default value is: 1.0