public class GenericLabeling extends AbstractMISLabeling
Node labels and edge labels placed by the labeling algorithm
This algorithm can switch between two internal implementations. By default, it generates high quality label placements
even for difficult instances. This especially holds if the label models allow a large number of different
LabelCandidate
s, i.e., there is a high potential for optimizations.
If the duration of the calculation is of utmost importance, the internal algorithm can be changed to a simpler
implementation by setting MaximumDuration
to
0
. On the downside, the results will not be as good as the ones of the default mode.
In default mode, this algorithm reduces the labeling problem to the maximum independent set (MIS) problem and solves the problem using simulated annealing. It is inspired by the article from Christensen, Marks and Shieber: A General Cartographic Labelling Algorithm.
It is recommended to use IEdgeLabelLayoutModel
s and
INodeLabelLayoutModel
s which allow free positioning of labels to achieve best
results with this generic labeling algorithm.
This algorithm works according to the general labeling concept defined by AbstractLabeling
.
AbstractLabeling
boxesToNodes, conflictGraph, graph, nodesToBoxes, nodesToID
LABEL_MODEL_DPKEY
Constructor and Description |
---|
GenericLabeling()
Creates a new instance of
GenericLabeling with default settings. |
Modifier and Type | Method and Description |
---|---|
long |
getMaximumDuration()
Gets the time limit for this algorithm in milliseconds.
|
boolean |
isDeterministicModeEnabled()
Gets whether or not this algorithm behaves deterministically.
|
void |
setDeterministicModeEnabled(boolean value)
Sets whether or not this algorithm behaves deterministically.
|
void |
setMaximumDuration(long value)
Sets the time limit for this algorithm in milliseconds.
|
assignProfit, createEdges, foundEdgeOverlap, foundHaloOverlap, foundLabelOverlap, foundNodeOverlap, getCustomProfitModelRatio, getOptimizationStrategy, isAmbiguityReductionEnabled, isEdgeOverlapsRemovalEnabled, isNodeOverlapsRemovalEnabled, setAmbiguityReductionEnabled, setCustomProfitModelRatio, setEdgeOverlapsRemovalEnabled, setNodeOverlapsRemovalEnabled, setOptimizationStrategy
applyLayout, getAffectedLabelsDpKey, getProfit, getProfitModel, isAutoFlippingEnabled, isEdgeGroupOverlapAllowed, isEdgeLabelPlacementEnabled, isInternalNodeLabelMovingEnabled, isLabelOverlapsReducingEnabled, isNodeLabelPlacementEnabled, label, label, label, setAffectedLabelsDpKey, setAutoFlippingEnabled, setEdgeGroupOverlapAllowed, setEdgeLabelPlacementEnabled, setInternalNodeLabelMovingEnabled, setLabelOverlapsReducingEnabled, setNodeLabelPlacementEnabled, setProfitModel
applyLayoutCore, getCoreLayout, setCoreLayout
public GenericLabeling()
GenericLabeling
with default settings.public long getMaximumDuration()
Integer.MAX_VALUE
denotes that there is no time limit. Values have to be greater than or equal to 0
.
IllegalArgumentException
- if the given maximum duration is negativeInteger.MAX_VALUE
. There is no time limit.setMaximumDuration(long)
public boolean isDeterministicModeEnabled()
If enabled, it produces the same results given the same input graph and settings.
true
. Labeling results are deterministic.true
if this algorithm works deterministically, false
otherwisesetDeterministicModeEnabled(boolean)
public void setDeterministicModeEnabled(boolean value)
If enabled, it produces the same results given the same input graph and settings.
true
. Labeling results are deterministic.value
- true
if this algorithm works deterministically, false
otherwiseisDeterministicModeEnabled()
public void setMaximumDuration(long value)
Integer.MAX_VALUE
denotes that there is no time limit. Values have to be greater than or equal to 0
.
IllegalArgumentException
- if the given maximum duration is negativeInteger.MAX_VALUE
. There is no time limit.value
- a non-negative value representing the time limit in millisecondsgetMaximumDuration()