Class AbstractLayout3DPC<N extends Layout.Node>
- java.lang.Object
-
- elki.visualization.parallel3d.layout.AbstractLayout3DPC<N>
-
- All Implemented Interfaces:
Layouter3DPC<NumberVector>
,SimilarityBasedLayouter3DPC
- Direct Known Subclasses:
CompactCircularMSTLayout3DPC
,MultidimensionalScalingMSTLayout3DPC
,SimpleCircularMSTLayout3DPC
public abstract class AbstractLayout3DPC<N extends Layout.Node> extends java.lang.Object implements SimilarityBasedLayouter3DPC
Abstract class for dimension similarity based layouters.- Since:
- 0.6.0
- Author:
- Erich Schubert
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AbstractLayout3DPC.AbstractNode<N extends AbstractLayout3DPC.AbstractNode<N>>
Abstract node implementation.private static class
AbstractLayout3DPC.LowerTriangularAdapter
Class to use a lower-triangular similarity matrix for distance-based Prim's spanning tree.static class
AbstractLayout3DPC.Par
Parameterization class.
-
Field Summary
Fields Modifier and Type Field Description (package private) Dependence
sim
Similarity measure-
Fields inherited from interface elki.visualization.parallel3d.layout.SimilarityBasedLayouter3DPC
SIM_ID
-
-
Constructor Summary
Constructors Constructor Description AbstractLayout3DPC(Dependence sim)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected N
buildSpanningTree(int dim, double[] mat, Layout layout)
Build the minimum spanning tree.protected N
buildTree(int[] msg, int cur, int parent, java.util.ArrayList<N> nodes)
Recursive tree build method.static double[]
computeSimilarityMatrix(Dependence sim, Relation<? extends NumberVector> rel)
Compute a column-wise dependency matrix for the given relation.static int
findOptimalRoot(int[] msg)
Find the "optimal" root of a spanning tree.Dependence
getSimilarity()
Get the similarity measure to use.abstract Layout
layout(int dim, double[] mat)
Main analysis method.Layout
layout(Relation<? extends NumberVector> rel)
Run the layouting algorithm.(package private) abstract N
makeNode(int dim, java.util.List<N> children)
protected int
maxDepth(Layout.Node node)
Compute the depth of the graph.
-
-
-
Field Detail
-
sim
Dependence sim
Similarity measure
-
-
Constructor Detail
-
AbstractLayout3DPC
public AbstractLayout3DPC(Dependence sim)
Constructor.- Parameters:
sim
- Similarity measure
-
-
Method Detail
-
getSimilarity
public Dependence getSimilarity()
Description copied from interface:SimilarityBasedLayouter3DPC
Get the similarity measure to use.- Specified by:
getSimilarity
in interfaceSimilarityBasedLayouter3DPC
- Returns:
- Similarity measure.
-
layout
public Layout layout(Relation<? extends NumberVector> rel)
Description copied from interface:Layouter3DPC
Run the layouting algorithm.- Specified by:
layout
in interfaceLayouter3DPC<N extends Layout.Node>
- Parameters:
rel
- Relation to use- Returns:
- Layout, nodes indexed by dimension.
-
computeSimilarityMatrix
public static double[] computeSimilarityMatrix(Dependence sim, Relation<? extends NumberVector> rel)
Compute a column-wise dependency matrix for the given relation.- Parameters:
sim
- Dependence measurerel
- Vector relation- Returns:
- Similarity matrix (lower triangular form)
-
layout
public abstract Layout layout(int dim, double[] mat)
Description copied from interface:SimilarityBasedLayouter3DPC
Main analysis method.- Specified by:
layout
in interfaceSimilarityBasedLayouter3DPC
- Parameters:
dim
- Dimensionalitymat
- Similarity matrix- Returns:
- Layout
-
buildSpanningTree
protected N buildSpanningTree(int dim, double[] mat, Layout layout)
Build the minimum spanning tree.- Parameters:
mat
- Similarity matrixlayout
- Layout to write to- Returns:
- Root node id
-
buildTree
protected N buildTree(int[] msg, int cur, int parent, java.util.ArrayList<N> nodes)
Recursive tree build method.- Parameters:
msg
- Minimum spanning graphcur
- Current nodeparent
- Parent nodenodes
- Nodes array to fill - must be preinitialized with nulls!- Returns:
- Tree of nodes
-
maxDepth
protected int maxDepth(Layout.Node node)
Compute the depth of the graph.- Parameters:
node
- Current node- Returns:
- Depth
-
findOptimalRoot
public static int findOptimalRoot(int[] msg)
Find the "optimal" root of a spanning tree. Optimal in the sense of: one of the most central nodes.This uses a simple message passing approach. Every node that has only one unset neighbor will emit a message to this neighbor. The node last to emit wins.
- Parameters:
msg
- Minimum spanning graph.- Returns:
- optimal root node.
-
-