Interface HierarchicCluster<T>
- Type Parameters:
T
- Type of elements contained by the clusters
- All Superinterfaces:
Cluster<T>
- All Known Subinterfaces:
IDBasedHierarchicCluster
Further division is also possibly hierarchic. The further division is represented by the child clusters, returned
by clusters()
.
Leaves (elements referenced by this cluster but not by others) are also directly available
The represented group is immutable, so List
modification operators are not supported, they throw
UnsupportedOperationException
upon calling.
Please note that this interface is marked with @Beta annotation, so it can be subject of incompatible changes or removal in later releases.
-
Method Summary
Modifier and TypeMethodDescriptionList<? extends HierarchicCluster<T>>
clusters()
Access further grouping of the represented elements.int
depth()
Distance from the associated root.int
height()
Distance from the farthest leave.int
Sum of child clusters count and leaves count.leaves()
Access immediate leaves associated to this node.Optional<? extends HierarchicCluster<T>>
parent()
Get parent for non roots.Methods inherited from interface com.chemaxon.clustering.common.Cluster
memberCount, members, representant
-
Method Details
-
clusters
List<? extends HierarchicCluster<T>> clusters()Access further grouping of the represented elements.Note that a hierarchic cluster might represent structures without further divisions: it is valid to contain
Cluster.members()
but not containclusters()
.- Returns:
- List of child clusters. The returned list is empty when no child clusters contained.
-
leaves
Access immediate leaves associated to this node.Leaves returned are part of members of this
Cluster
(returned byCluster.members()
) but not part of any of the child clusters (returned byclusters()
.Note that representant structure
Cluster.representant()
might be part of the leaves of this cluster or any of its child clusters leaves.- Returns:
- List of leaves. The returned list is empty when no leaves associated (all represented nodes are further clustered).
-
depth
int depth()Distance from the associated root.Note that interpretation is similar to D3's
d3.hierarchy
node.depth
.- Returns:
- Zero for a root node having no parent, otherwise
depth()
of parent plus one
-
height
int height()Distance from the farthest leave.Note that interpretation is similar to D3's
d3.hierarchy
node.height
for internal nodes.- Returns:
- One for clusters having only immediate
leaves()
but no childclusters()
, otherwise the maximum of the child clustersheight()
plus one.
-
immediateDescendantsCount
int immediateDescendantsCount()Sum of child clusters count and leaves count.- Returns:
- Sum of leaves and immediate children count
-
parent
Optional<? extends HierarchicCluster<T>> parent()Get parent for non roots.- Returns:
- Perent cluster for non root clusters.
-