Class Dendogram<U>
java.lang.Object
es.uam.eps.ir.relison.sna.community.Dendogram<U>
- Type Parameters:
U
- Type of the users.
public class Dendogram<U>
extends java.lang.Object
Abstract class that represents a dendogram and its functions.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description java.util.Map<java.lang.Integer,Communities<U>>
getCommunitiesByNumber()
Gets all possible community partitions by number.Communities<U>
getCommunitiesByNumber(int n)
Obtains a community partition, containing, at most, a given number of communities.java.util.Map<java.lang.Integer,Communities<U>>
getCommunitiesBySize()
Obtains all the possible community partitions, given the size of the communities.Communities<U>
getCommunitiesBySize(int size)
Obtains a community partition, trying to provide communities with a given size.private Communities<U>
getCommunitiesBySize(int node, int size)
Auxiliary recursive method.Tree<java.lang.Integer>
getTree()
Obtains the dendogram tree.
-
Field Details
-
index
An index for relating the graph and the tree. -
graph
The original graph -
tree
The dendogram tree. In this tree, nodes from 0 to numNodes-1 represent the leaf nodes (i.e.: the nodes in the graph). Nodes from numNodes to 2*numNodes-2 represent the joints of the dendogram.Given an edge in the tree, the weight represents the number of leaves the child node is parent of.
-
-
Constructor Details
-
Dendogram
public Dendogram(FastIndex<U> index, Graph<U> graph, java.util.stream.Stream<org.jooq.lambda.tuple.Tuple3<java.lang.Integer,java.lang.Integer,java.lang.Integer>> triplets)Constructor.- Parameters:
index
- An index for identifying nodes in the graph, and nodes in the tree.graph
- The original graph.triplets
- The dendogram tree. Ordered from root to leaves.
-
-
Method Details
-
getTree
Obtains the dendogram tree. To prevent from modifying the original tree, this provides a copy.- Returns:
- The dendogram tree.
-
getCommunitiesByNumber
Obtains a community partition, containing, at most, a given number of communities.- Parameters:
n
- The maximum number of communities.- Returns:
- the community partition, null if the number is invalid or something failed.
-
getCommunitiesByNumber
Gets all possible community partitions by number.- Returns:
- A map containing all the possible partitions.
-
getCommunitiesBySize
Obtains a community partition, trying to provide communities with a given size.- Parameters:
size
- The maximum size of the communities.- Returns:
- the community partition, or null if something failed.
-
getCommunitiesBySize
Auxiliary recursive method.- Parameters:
node
- The starting node.size
- The maximum size of the communities.- Returns:
- the community partition, or null if something failed.
-
getCommunitiesBySize
Obtains all the possible community partitions, given the size of the communities.- Returns:
- all the possible community partitions.
-