|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.algo.Groups.Dendrogram
public static class Groups.Dendrogram
This class provides the result of hierarchical clustering algorithms by means of a binary tree structure.
The dendrogram is created using the agglomerative strategy (i.e., a bottom-up approach) based on the following steps:
0
), each node belongs to its own cluster. At this point, each
node of the original graph (the one that will be clustered) is mapped to one of the dendrogram nodes that represent
a leaf node (i.e., a node with no children).
getDissimilarityValue(Node)
. The dissimilarity values are monotone increasing starting from zero
which corresponds to the leaf nodes of the dendrogram.
getRoot()
.
The dendrogram is a binary tree that is directed from the root to the leaves.
This means that one can iterate the dendrogram starting with the root node
, moving
on to its children
, then moving on to their children and so on.
From each node of the dendrogram, it is possible to retrieve the set of nodes of the original graph that belong
to this dendrogram node using getClusterNodes(Node)
. This method returns an array of NodeList
s that
contain the nodes of all clusters that are merged when this dendrogram node was created. For example, say that clusters
C1 = {v1, v2}
and C2 = {v3, v4}
are merged, where {v1, v2, v3, v4}
are nodes
of the original graph. Say that dendrogram node u
is created by this merging. Then, the cluster
nodes of u
will be returned as two NodeList
s where the first
contains nodes v1, v2
and the second v3, v4
.
leaf nodes
of the dendrogram are mapped with a node of the original graph.
This means that for all other inner nodes of the dendrogram, method getOriginalNode(Node)
returns null
.Groups.hierarchicalClustering(Graph, Distances, byte)
,
Groups.hierarchicalClustering(Graph, int, NodeMap, Distances, byte)
,
Groups.hierarchicalClustering(Graph, NodeMap, Distances, byte, double)
Method Summary | |
---|---|
NodeList |
getChildren(Node parent)
Returns a NodeList that contains the child nodes of the given parent node. |
NodeList[] |
getClusterNodes(Node node)
Returns an array of NodeList s that contain the nodes of the original graph that are associated with the
given dendrogram node. |
double |
getDissimilarityValue(Node node)
Returns the dissimilarity value associated with the given node of the dendrogram. |
int |
getLevel(Node node)
Returns the level of the given node of the dendrogram. |
int |
getLevelCount()
Returns the number of levels this dendrogram has. |
Node |
getNodeAtLevel(int level)
Returns the node of the dendrogram that belongs to the given level index. |
int |
getNodeCount()
Returns the number of nodes in this dendrogram. |
Node |
getOriginalNode(Node node)
Returns the node of original graph that is mapped with the given leaf node of the dendrogram. |
Node |
getRoot()
Returns the root node of the dendrogram. |
boolean |
isLeaf(Node node)
Returns whether or not the given dendrogram node is a leaf node. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public Node getRoot()
A dendrogram traversal can be implemented by starting from this node, then moving on to its children
using method getChildren(Node)
, and so on.
public NodeList getChildren(Node parent)
NodeList
that contains the child nodes of the given parent node.
If the given node is a leaf
node, the returned list will be empty.
parent
- the parent node for which to retrieve the child nodes
public int getLevel(Node node)
Node
that belongs to the dendrogram representation and
not to the original graph.node
- the given dendrogram node
public Node getNodeAtLevel(int level)
If the given level index is greater than the number of levels
, then this
method will return null
.
level
- the given level index
null
if there exists
no level with the given index.
java.lang.IllegalArgumentException
- if the given level is negative or greater than
the node count
minus one.public Node getOriginalNode(Node node)
null
if
the given node is not a leaf node.node
- the given leaf node
null
if the given node
is an inner dendrogram nodepublic double getDissimilarityValue(Node node)
Node
that belongs to the dendrogram representation and
not to the original graph.node
- the given dendrogram node
public NodeList[] getClusterNodes(Node node)
NodeList
s that contain the nodes of the original graph that are associated with the
given dendrogram node.
Each such NodeList
represents nodes that belong to the same cluster. For example, say that clusters
C1 = {v1, v2}
and C2 = {v3, v4}
are merged, where {v1, v2, v3, v4}
are nodes
of the original graph. Say that dendrogram node u
is created by this merging. Then, the cluster
nodes of u
will be returned as two NodeList
s where the first
contains nodes v1, v2
and the second v3, v4
.
Node
that belongs to the dendrogram representation and
not to the original graph.node
- the given dendrogram node
NodeList
s that contain the nodes of the original graph that are associated with the
given dendrogram nodepublic boolean isLeaf(Node node)
A leaf node has no further children and represents a node of the original graph. The original node
can be retrieved via getOriginalNode(Node)
.
Node
that belongs to the dendrogram representation and
not to the original graph.node
- a dendrogram node
true
if the given node is a leaf node, false
otherwisepublic int getNodeCount()
public int getLevelCount()
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |