This class is an implementation of the IPortCandidateSelector interface that tries to select suitable LayoutPortCandidates considering the specified NodePortCandidates and EdgePortCandidates.
Remarks
Instances of this class can be set using property portCandidateSelector.
This implementation will query sourcePortCandidates, targetPortCandidates and nodePortCandidates. It will try to assign each edge one of the matching LayoutPortCandidates considering their cost without introducing too many crossings and without violating the capacity constraints.
Default Values of Properties
backLoopCost | 1.0 | |
crossingCost | 10.0d | |
deterministic | true | A deterministic algorithm will be applied. |
overUsageCost | 100.0d |
Type Details
- yFiles module
- algorithms
See Also
Constructors
Creates a new instance of PortCandidateSelector with the default settings.
Properties
Gets or sets the cost associated with each back-loop.
Remarks
Default Value
1.0
.Property Value
Throws
- Exception({ name: 'ArgumentError' })
- if the back-loop cost is negative
Gets or sets the cost associated with a crossing that would occur if a given combination of LayoutPortCandidates would be chosen.
Remarks
Default Value
10.0d
.Property Value
Throws
- Exception({ name: 'ArgumentError' })
- if the crossing cost is negative
Gets or sets whether this implementation uses a deterministic algorithm to assign the LayoutPortCandidates.
Default Value
true
.A deterministic algorithm will be applied.
Property Value
true
if a deterministic algorithm should be applied, false
otherwiseGets or sets the cost associated with each edge being assigned to a port which has already reached its capacity.
Remarks
Default Value
100.0d
.Property Value
Throws
- Exception({ name: 'ArgumentError' })
- if the cost is negative
See Also
Methods
insertSameLayerStructures
(graph: LayoutGraph, layoutContext: HierarchicalLayoutContext) : PortCandidateSelectorSameLayerDataInserts a same-layer edge structure for each same-layer edge of the original graph.
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
- layoutContext - HierarchicalLayoutContext
- The HierarchicalLayoutContext implementation which provides context information for the graph elements, as well as the ItemFactory that sets the temporary port constraints.
Returns
- ↪PortCandidateSelectorSameLayerData
- An object that provides information about the inserted same-layer structures.
See Also
(s,t)
consists of a temporary node w
and edges (s,w)
and (t,w)
.removeSameLayerStructures
(sameLayerData: PortCandidateSelectorSameLayerData, graph: LayoutGraph, layoutContext: HierarchicalLayoutContext)Removes the same-layer edge structure created using insertSameLayerStructures.
Parameters
A map of options to pass to the method.
- sameLayerData - PortCandidateSelectorSameLayerData
- A given PortCandidateSelectorSameLayerData instance holding the information about the same-layer structures.
- graph - LayoutGraph
- The input graph
- layoutContext - HierarchicalLayoutContext
- The HierarchicalLayoutContext implementation which provides context information for the graph elements, as well as the ItemFactory that sets the temporary port constraints.
See Also
Assigns new selected port candidates after the layering information has been determined.
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- The input graph
- layoutContext - HierarchicalLayoutContext
- The HierarchicalLayoutContext containing information about the elements, as well as the ItemFactory instance to set the selected port candidates with.
See Also
Implements
Assigns new selected port candidates after the sequence of the nodes has been determined.
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
- layoutContext - HierarchicalLayoutContext
- The HierarchicalLayoutContext providing context information about the graph elements, as well as the ItemFactory instance to set the selected port candidates with.
See Also
Implements
selectAfterSequencingAtNode
(node: LayoutNode, inEdgeOrder: function(LayoutEdge, LayoutEdge):number, outEdgeOrder: function(LayoutEdge, LayoutEdge):number, graph: LayoutGraph, layoutContext: HierarchicalLayoutContext)Assigns new temporary port constraints to a given node of the graph after the order of the nodes in each layer has been determined.
Remarks
More precisely, it is called after the sequence of the nodes has been determined.
Incoming and outgoing edges are sorted using comparison instances which define the preferred ordering of the incoming and outgoing edges from left to right.
Parameters
A map of options to pass to the method.
- node - LayoutNode
- the original node to set temporary port constraints
- inEdgeOrder - function(LayoutEdge, LayoutEdge):number
- a given comparison instance for incoming edges
Signature Details
function(x: LayoutEdge, y: LayoutEdge) : number
Encapsulates a method that compares two objects.Parameters
- x - LayoutEdge
- The first object to compare.
- y - LayoutEdge
- The second object to compare.
Returns
- number
- An integer value which is
<0
ifx
is less thany
,0
ifx
is equal toy
, or>0
ifx
is greater thany
- outEdgeOrder - function(LayoutEdge, LayoutEdge):number
- a given comparison instance for outgoing edges
Signature Details
function(x: LayoutEdge, y: LayoutEdge) : number
Encapsulates a method that compares two objects.Parameters
- x - LayoutEdge
- The first object to compare.
- y - LayoutEdge
- The second object to compare.
Returns
- number
- An integer value which is
<0
ifx
is less thany
,0
ifx
is equal toy
, or>0
ifx
is greater thany
- graph - LayoutGraph
- the input graph
- layoutContext - HierarchicalLayoutContext
- The HierarchicalLayoutContext implementation which provides context information for the graph elements, as well as the ItemFactory that sets the temporary port constraints.
See Also
selectAfterSequencingWithOrders
(inEdgeOrder: function(LayoutEdge, LayoutEdge):number, outEdgeOrder: function(LayoutEdge, LayoutEdge):number, graph: LayoutGraph, layoutContext: HierarchicalLayoutContext)Assigns new temporary port constraints after the order of the nodes in each layer has been determined.
Remarks
More precisely, it is called after the sequence of the nodes has been determined.
Incoming and outgoing edges are sorted using comparison instances which define the preferred ordering of the incoming and outgoing edges from left to right.
Parameters
A map of options to pass to the method.
- inEdgeOrder - function(LayoutEdge, LayoutEdge):number
- a given comparison instance for incoming edges
Signature Details
function(x: LayoutEdge, y: LayoutEdge) : number
Encapsulates a method that compares two objects.Parameters
- x - LayoutEdge
- The first object to compare.
- y - LayoutEdge
- The second object to compare.
Returns
- number
- An integer value which is
<0
ifx
is less thany
,0
ifx
is equal toy
, or>0
ifx
is greater thany
- outEdgeOrder - function(LayoutEdge, LayoutEdge):number
- a given comparison instance for outgoing edges
Signature Details
function(x: LayoutEdge, y: LayoutEdge) : number
Encapsulates a method that compares two objects.Parameters
- x - LayoutEdge
- The first object to compare.
- y - LayoutEdge
- The second object to compare.
Returns
- number
- An integer value which is
<0
ifx
is less thany
,0
ifx
is equal toy
, or>0
ifx
is greater thany
- graph - LayoutGraph
- the input graph
- layoutContext - HierarchicalLayoutContext
- The HierarchicalLayoutContext implementation which provides context information for the graph elements, as well as the ItemFactory that sets the temporary port constraints.