|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.algo.NodeAggregation
public class NodeAggregation
This class realizes an algorithm that aggregates nodes
and creates a hierarchical clustering structure
subject to user-specified constraints like the type of nodes
as well as the
preferred minimum
and maximum
size of a cluster.
The result of the aggregation can be used to (interactively) visualize parts of large graphs.
Note that the resulting clustering structure corresponds to a directed rooted tree which we encode by means of a set
of AggregationInfo
instances.
More precisely, each node of the original graph is mapped to a unique AggregationInfo
instance. This mapping
is stored in the NodeMap
that is passed to method aggregate(Graph, NodeMap)
.
Each AggregationInfo
has a reference to its parent
which
induces a directed tree structure. There is always exactly one AggregationInfo
without a parent
that represents the root of the tree. Property setNodesOnlyOnLeavesAllowed(boolean)
allows to specify
whether nodes are only mapped to leaves of the tree structure or if they can also be mapped to inner nodes.
Property setAggregationPolicy(byte)
allows to specify whether the algorithm should consider
structural properties
(i.e., considering the connectivity) for the aggregation
or geometric properties
(i.e., the distance between nodes).
For the second policy, the coordinates of the nodes have to be specified by the user by means of a DataProvider
registered with key NODE_CENTER_DPKEY
.
Field Summary | |
---|---|
static byte |
AGGREGATION_POLICY_GEOMETRIC
An aggregation policy that specifies that nodes are aggregated according to their geometric position. |
static byte |
AGGREGATION_POLICY_STRUCTURAL
An aggregation policy that specifies that nodes are aggregated according to their structure, that is, the connectivity. |
static java.lang.Object |
EDGE_DIRECTEDNESS_DPKEY
A DataProvider key for specifying the directedness of edges.
|
static java.lang.Object |
EDGE_WEIGHT_DPKEY
A DataProvider key for specifying the (non-negative) weights of the edges.
|
static java.lang.Object |
NODE_CENTER_DPKEY
A DataProvider key for specifying the coordinates of the nodes.
|
static java.lang.Object |
NODE_TYPE_DPKEY
A DataProvider key for specifying the type of the nodes.
|
static byte |
NODE_TYPE_HANDLING_IGNORE
A node type handling policy that specifies that the types are ignored. |
static byte |
NODE_TYPE_HANDLING_SEPARATE_AT_LEAVES
A node type handling policy that specifies that nodes of different types are always separated at the leaves. |
static byte |
NODE_TYPE_HANDLING_SEPARATE_AT_ROOT
A node type handling policy that specifies that nodes of different types are always separated right at the root. |
static java.lang.Object |
NODE_WEIGHT_DPKEY
A DataProvider key for specifying the (non-negative) weights of the nodes.
|
static java.lang.Object |
TOP_LEVEL_NODES_DPKEY
A DataProvider key for specifying the top-level nodes of the aggregation info.
|
Constructor Summary | |
---|---|
NodeAggregation()
Creates a new NodeAggregation instance with default settings. |
Method Summary | |
---|---|
void |
aggregate(Graph graph,
NodeMap aggregationResult)
Starts the node aggregation for the specified graph. |
byte |
getAggregationPolicy()
Returns the policy applied for determining the clusters. |
int |
getMaximumClusterSize()
Returns the preferred maximum number of elements contained in a cluster. |
long |
getMaximumDuration()
Returns the maximum duration in milliseconds that this layout algorithm is allowed to run. |
int |
getMinimumClusterSize()
Returns the preferred minimum number of elements contained in a cluster. |
byte |
getNodeTypeHandlingPolicy()
Returns the policy for handling nodes of different type. |
boolean |
isMultiThreadingAllowed()
Returns whether or not the layout algorithm may use multi-threading to reduce the running time. |
boolean |
isNodesOnlyOnLeavesAllowed()
Returns whether or not all original nodes are only mapped to leaves of the directed rooted aggregation tree that represents the hierarchical clustering structure. |
void |
setAggregationPolicy(byte aggregationPolicy)
Specifies the policy applied for determining the clusters. |
void |
setMaximumClusterSize(int maximumClusterSize)
Specifies the preferred maximum number of elements contained in a cluster. |
void |
setMaximumDuration(long maximumDurationMillis)
Specifies the maximum duration in milliseconds that this layout algorithm is allowed to run. |
void |
setMinimumClusterSize(int minimumClusterSize)
Specifies the preferred minimum number of elements contained in a cluster. |
void |
setMultiThreadingAllowed(boolean multiThreadingAllowed)
Specifies whether or not the layout algorithm may use multi-threading to reduce the running time. |
void |
setNodesOnlyOnLeavesAllowed(boolean nodesOnlyOnLeavesAllowed)
Specifies whether or not all original nodes are only mapped to leaves of the directed rooted aggregation tree that represents the hierarchical clustering structure. |
void |
setNodeTypeHandlingPolicy(byte nodeTypeHandlingPolicy)
Specifies the policy for handling nodes of different type. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final byte NODE_TYPE_HANDLING_IGNORE
setNodeTypeHandlingPolicy(byte)
,
NODE_TYPE_DPKEY
,
Constant Field Valuespublic static final byte NODE_TYPE_HANDLING_SEPARATE_AT_ROOT
Separating at the root means that the top-level cluster of the aggregation is the only one that may
(indirectly) contain nodes of different types.
The only exception to this rules is if there are group nodes
, because
a group is a kind of user-specified cluster and, thus, may contain nodes with different types.
setNodeTypeHandlingPolicy(byte)
,
NODE_TYPE_DPKEY
,
Constant Field Valuespublic static final byte NODE_TYPE_HANDLING_SEPARATE_AT_LEAVES
More precisely, all direct children of a cluster of the aggregation are associated with the same type. Note that, for this policy, the algorithm may assign nodes without type to any cluster (even though the cluster already has some nodes of a specific type).
setNodeTypeHandlingPolicy(byte)
,
NODE_TYPE_DPKEY
,
Constant Field Valuespublic static final java.lang.Object TOP_LEVEL_NODES_DPKEY
DataProvider
key for specifying the top-level nodes of the aggregation info.
Top-level nodes are directly contained in the root cluster of the aggregation result or in direct children of the
root if there are top-level nodes with different types (nodes of different type are not allowed to be directly
contained in the same cluster).
The only exception to this rules is if there are group nodes
, because
a group is a kind of user-specified cluster and, thus, a top-level node contained in a group is always placed in
the cluster associated with that group.
public static final java.lang.Object NODE_CENTER_DPKEY
DataProvider
key for specifying the coordinates of the nodes.
If the aggregation policy
is set to AGGREGATION_POLICY_GEOMETRIC
,
these coordinates are considered during the aggregation of nodes.
aggregation policy
is set to AGGREGATION_POLICY_GEOMETRIC
.setAggregationPolicy(byte)
,
AGGREGATION_POLICY_GEOMETRIC
public static final java.lang.Object NODE_TYPE_DPKEY
DataProvider
key for specifying the type of the nodes.
Nodes mapped to equal objects are considered to be of the same type.
Property setNodeTypeHandlingPolicy(byte)
specifies how the algorithm should handle nodes of different type.
setNodeTypeHandlingPolicy(byte)
public static final java.lang.Object NODE_WEIGHT_DPKEY
DataProvider
key for specifying the (non-negative) weights of the nodes.
Depending on the exact setting, the algorithm applies multiple different aggregation approaches and chooses the best one. If nodes have weights, it prefers aggregation results where nodes with higher weight are closer to the root of the aggregation hierarchy.
public static final java.lang.Object EDGE_WEIGHT_DPKEY
DataProvider
key for specifying the (non-negative) weights of the edges.
If the aggregation policy
is set to AGGREGATION_POLICY_STRUCTURAL
,
nodes connected by edges with high weights are more likely to be clustered together.
aggregation policy
is set to AGGREGATION_POLICY_STRUCTURAL
.setAggregationPolicy(byte)
,
AGGREGATION_POLICY_STRUCTURAL
public static final java.lang.Object EDGE_DIRECTEDNESS_DPKEY
DataProvider
key for specifying the directedness of edges.
Generally, for this node aggregation algorithm, the effect of specifying an edge directedness is quite low.
It is mainly used for the detection of substructures, see Substructures
.
A substructure is only identified as such if all edges are either undirected or consistently directed
with respect to the specified directedness.
1
indicates that the edge is considered to be
directed from source to target.
-1
indicates that the edge is considered to be
directed from target to source.
0
indicates that the edge is considered to be
undirected.
DataProvider
is registered with this key, the algorithm assumes that all
edges have directedness 0.0
.public static final byte AGGREGATION_POLICY_STRUCTURAL
setAggregationPolicy(byte)
,
NODE_CENTER_DPKEY
,
Constant Field Valuespublic static final byte AGGREGATION_POLICY_GEOMETRIC
More precisely, nodes that are placed close to each other are more likely to be contained in the same cluster.
The coordinates of the nodes have to be specified by the user by means of a DataProvider
registered to the graph with key NODE_CENTER_DPKEY
.
setAggregationPolicy(byte)
,
NODE_CENTER_DPKEY
,
Constant Field ValuesConstructor Detail |
---|
public NodeAggregation()
NodeAggregation
instance with default settings.
Method Detail |
---|
public boolean isNodesOnlyOnLeavesAllowed()
If this property is disabled, nodes can also represent inner nodes and, thus, contain other node elements. This may allow a more efficient representation of the resulting tree structure. For example, for a star-like structure in the input graph, the root of the star can directly represent the parent aggregate of the star. Otherwise, an additional virtual tree node must be inserted.
true
if nodes are only mapped to leaves, false
otherwisesetNodesOnlyOnLeavesAllowed(boolean)
public void setNodesOnlyOnLeavesAllowed(boolean nodesOnlyOnLeavesAllowed)
If this property is disabled, nodes can also represent inner nodes and, thus, contain other node elements. This may allow a more efficient representation of the resulting tree structure. For example, for a star-like structure in the input graph, the root of the star can directly represent the parent aggregate of the star. Otherwise, an additional virtual tree node must be inserted.
nodesOnlyOnLeavesAllowed
- true
if nodes should only be mapped to leaves,
false
otherwisepublic long getMaximumDuration()
The duration needs to be non-negative.
setMaximumDuration(long)
public void setMaximumDuration(long maximumDurationMillis)
The duration needs to be non-negative.
Long.MAX_VALUE
. The algorithm runs unrestricted.maximumDurationMillis
- a non-negative duration in milliseconds
java.lang.IllegalArgumentException
- if the specified duration has a negative valuepublic byte getNodeTypeHandlingPolicy()
setNodeTypeHandlingPolicy(byte)
public void setNodeTypeHandlingPolicy(byte nodeTypeHandlingPolicy)
NODE_TYPE_HANDLING_IGNORE
nodeTypeHandlingPolicy
- the policy for handling nodes of different type
java.lang.IllegalArgumentException
- if an unknown policy is providedpublic byte getAggregationPolicy()
setAggregationPolicy(byte)
public void setAggregationPolicy(byte aggregationPolicy)
AGGREGATION_POLICY_STRUCTURAL
aggregationPolicy
- the policy applied for determining the clusters
java.lang.IllegalArgumentException
- if an unknown policy is providedpublic boolean isMultiThreadingAllowed()
true
if multi-threading is used, false
otherwisesetMultiThreadingAllowed(boolean)
public void setMultiThreadingAllowed(boolean multiThreadingAllowed)
multiThreadingAllowed
- true
if multi-threading should be used, false
otherwisepublic int getMinimumClusterSize()
The minimum allowed value for this property is 1
.
setMinimumClusterSize(int)
,
setMaximumClusterSize(int)
public void setMinimumClusterSize(int minimumClusterSize)
The minimum allowed value for this property is 1
.
minimumClusterSize
- the preferred minimum number of elements contained in a cluster
java.lang.IllegalArgumentException
- if the minimum cluster size is less than 1setMaximumClusterSize(int)
public int getMaximumClusterSize()
The minimum allowed value for this property is 2
.
setMaximumClusterSize(int)
,
setMinimumClusterSize(int)
public void setMaximumClusterSize(int maximumClusterSize)
The minimum allowed value for this property is 2
.
maximumClusterSize
- the preferred maximum number of elements contained in a cluster
java.lang.IllegalArgumentException
- if the maximum cluster size is less than 2setMinimumClusterSize(int)
public void aggregate(Graph graph, NodeMap aggregationResult)
The aggregation result corresponds to a directed rooted tree which we encode by means of a set
of AggregationInfo
instances.
More precisely, each node of the original graph is mapped to a unique AggregationInfo
instance that is
stored in the given NodeMap
aggregationResult
.
Each AggregationInfo
has a reference to its parent
which
induces a directed tree structure. There is always exactly one AggregationInfo
without a parent
that represents the root of the tree.
graph
- the input graphaggregationResult
- stores the result of the aggregation
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |