@Reference(authors="R. C. Prim", title="Shortest connection networks and some generalizations", booktitle="Bell System Technical Journal, 36 (1957)") public class PrimsMinimumSpanningTree extends Object
R. C. Prim
Shortest connection networks and some generalizations
In: Bell System Technical Journal, 36 (1957), pp. 1389–140
Modifier and Type | Class and Description |
---|---|
static interface |
PrimsMinimumSpanningTree.Adapter<T>
Adapter interface to allow use with different data representations.
|
static class |
PrimsMinimumSpanningTree.Array2DAdapter
Adapter for a simple 2d double matrix.
|
static interface |
PrimsMinimumSpanningTree.Collector
Interface for collecting edges.
|
Modifier and Type | Field and Description |
---|---|
static PrimsMinimumSpanningTree.Array2DAdapter |
ARRAY2D_ADAPTER
Adapter class for double[][] matrixes.
|
Constructor and Description |
---|
PrimsMinimumSpanningTree() |
Modifier and Type | Method and Description |
---|---|
static int[] |
processDense(double[][] mat)
Process a k x k distance matrix.
|
static int[] |
processDense(Matrix mat)
Process a k x k distance matrix.
|
static <T> int[] |
processDense(T data,
PrimsMinimumSpanningTree.Adapter<T> adapter)
Run Prim's algorithm on a dense graph.
|
static <T> void |
processDense(T data,
PrimsMinimumSpanningTree.Adapter<T> adapter,
PrimsMinimumSpanningTree.Collector collector)
Run Prim's algorithm on a dense graph.
|
static int[] |
pruneTree(int numnodes,
int[] tree,
int minDegree)
Prune the minimum spanning tree, removing all edges to nodes that have a
degree below
minDegree . |
public static final PrimsMinimumSpanningTree.Array2DAdapter ARRAY2D_ADAPTER
public static int[] processDense(double[][] mat)
mat
- Distance matrixpublic static int[] processDense(Matrix mat)
mat
- Distance matrixpublic static <T> int[] processDense(T data, PrimsMinimumSpanningTree.Adapter<T> adapter)
data
- Data setadapter
- Adapter instancepublic static <T> void processDense(T data, PrimsMinimumSpanningTree.Adapter<T> adapter, PrimsMinimumSpanningTree.Collector collector)
data
- Data setadapter
- Adapter instancecollector
- Edge collectorpublic static int[] pruneTree(int numnodes, int[] tree, int minDegree)
minDegree
.numnodes
- Number of nodes (MUST use numbers 0 to numnodes-1
)tree
- Original spanning treeminDegree
- Minimum node degreeCopyright © 2015 ELKI Development Team, Lehr- und Forschungseinheit für Datenbanksysteme, Ludwig-Maximilians-Universität München. License information.