de.aitools.aq.graph.weighted.util
Class KNNGraph

java.lang.Object
  extended by de.aitools.aq.graph.weighted.util.KNNGraph

Deprecated. new implementation will be added soon. It will use a GraphCreator interface. KNN is then only one of different concrete classes.

public final class KNNGraph
extends java.lang.Object

Version:
$Id: KNNGraph.java,v 1.3 2011/09/29 12:43:04 dogu3912 Exp $
Author:
johannes.kiesel(/\t)uni-weimar.de

Method Summary
static
<V> UndirectedMutableGraph<V>
createUndirectedKNNGraph(Vector[] data, V[] vertices, java.util.Comparator<V> vertexComparator, Proximity<Vector> proximity, int k)
          Deprecated. Create an undirected K-Nearest-Neighbor-Graph.
static
<V> UndirectedMutableGraph<V>
createUndirectedKNNGraph(Vector[] data, V[] vertices, java.util.Comparator<V> vertexComparator, Proximity<Vector> proximity, int k, double noEdgeWeight)
          Deprecated. Create an undirected K-Nearest-Neighbor-Graph.
static UndirectedMutableIntGraph createUndirectedKNNIntGraph(Vector[] data, Proximity<Vector> proximity, int k)
          Deprecated. Create an undirected K-Nearest-Neighbor-Graph.
static UndirectedMutableIntGraph createUndirectedKNNIntGraph(Vector[] data, Proximity<Vector> proximity, int k, double noEdgeWeight)
          Deprecated. Create an undirected K-Nearest-Neighbor-Graph.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createUndirectedKNNGraph

public static <V> UndirectedMutableGraph<V> createUndirectedKNNGraph(Vector[] data,
                                                                     V[] vertices,
                                                                     java.util.Comparator<V> vertexComparator,
                                                                     Proximity<Vector> proximity,
                                                                     int k,
                                                                     double noEdgeWeight)
Deprecated. 
Create an undirected K-Nearest-Neighbor-Graph. Given a vertex vx, an edge to another vertex vy is only created if the proximity p(vx,vy) is one of the k highest proximities of p(vx,vi) for all vi in given data with vi != vx.
As this is creates an undirected graph, this does not necessarily mean that each vertex is connected to exactly k other vertex.

Parameters:
data - The vectors to create the graph of.
vertices - The vertices of the graph. vertices[i] will be treated as representative of data[i].
vertexComparator - The comparator is used to create the ComparablesUndirectedGraph.
proximity - Proximity measure to use on creating the graph.
k - Number of nearest neighbors. Must be greater than zero and less than the number of vectors.
noEdgeWeight - Weight for all possible links between two vertices that are not connected. See UndirectedMutableIntGraph.setUnconnectedWeight(double).
Returns:
The created graph.

createUndirectedKNNGraph

public static <V> UndirectedMutableGraph<V> createUndirectedKNNGraph(Vector[] data,
                                                                     V[] vertices,
                                                                     java.util.Comparator<V> vertexComparator,
                                                                     Proximity<Vector> proximity,
                                                                     int k)
Deprecated. 
Create an undirected K-Nearest-Neighbor-Graph. Given a vertex vx, an edge to another vertex vy is only created if the proximity p(vx,vy) is one of the k highest proximities of p(vx,vi) for all vi in given data with vi != vx.
As this is creates an undirected graph, this does not necessarily mean that each vertex is connected to exactly k other vertex.
The weight of all removed edges will be set to the lowest weight found in the complete graph.

Parameters:
data - The vectors to create the graph of.
vertices - The vertices of the graph. vertices[i] will be treated as representative of data[i].
vertexComparator - The comparator is used to create the ComparablesUndirectedGraph.
proximity - Proximity measure to use on creating the graph.
k - Number of nearest neighbors. Must be greater than zero and less than the number of vectors. UndirectedMutableIntGraph.setUnconnectedWeight(double).
Returns:
The created graph.

createUndirectedKNNIntGraph

public static UndirectedMutableIntGraph createUndirectedKNNIntGraph(Vector[] data,
                                                                    Proximity<Vector> proximity,
                                                                    int k,
                                                                    double noEdgeWeight)
Deprecated. 
Create an undirected K-Nearest-Neighbor-Graph. Given a vertex vx, an edge to another vertex vy is only created if the proximity p(vx,vy) is one of the k highest proximities of p(vx,vi) for all vi in given data with vi != vx.
As this is creates an undirected graph, this does not necessarily mean that each vertex is connected to exactly k other vertex.

Parameters:
data - The vectors to create the graph of.
proximity - Proximity measure to use on creating the graph.
k - Number of nearest neighbors. Must be greater than zero and less than the number of vectors.
noEdgeWeight - Weight for all possible links between two vertices that are not connected. See UndirectedMutableIntGraph.setUnconnectedWeight(double).
Returns:
The created graph.

createUndirectedKNNIntGraph

public static UndirectedMutableIntGraph createUndirectedKNNIntGraph(Vector[] data,
                                                                    Proximity<Vector> proximity,
                                                                    int k)
Deprecated. 
Create an undirected K-Nearest-Neighbor-Graph. Given a vertex vx, an edge to another vertex vy is only created if the proximity p(vx,vy) is one of the k highest proximities of p(vx,vi) for all vi in given data with vi != vx.
As this is creates an undirected graph, this does not necessarily mean that each vertex is connected to exactly k other vertex.
The weight of all removed edges will be set to the lowest weight found in the complete graph.

Parameters:
data - The vectors to create the graph of.
proximity - Proximity measure to use on creating the graph.
k - Number of nearest neighbors. Must be greater than zero and less than the number of vectors.
Returns:
The created graph.