T
- The type of nodes valuepublic class Graph<T> extends HashMap<Node<T>,NeighborList>
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
Modifier and Type | Method and Description |
---|---|
ArrayList<Graph<T>> |
connectedComponents()
Split the graph in connected components (usually you will first prune the
graph to remove "weak" edges).
|
NeighborList |
get(Node node)
Get the neighborlist of this node
|
void |
prune(double threshold)
Remove from the graph all edges with a similarity lower than threshold
|
NeighborList |
search(Node<T> query,
int K,
int restarts,
int search_depth,
SimilarityInterface<T> similarity_measure) |
NeighborList |
search(Node<T> query,
int K,
int restarts,
int search_depth,
SimilarityInterface<T> similarity_measure,
int[] computed_similarities)
Implementation of Graph Nearest Neighbor Search (GNNS) algorithm
from paper "Fast Approximate Nearest-Neighbor Search with k-Nearest
Neighbor Graph" by Hajebi et al.
|
ArrayList<Graph<T>> |
stronglyConnectedComponents()
Computes the strongly connected sub-graphs (where every node is reachable
from every other node) using Tarjan's algorithm, which has computation
cost O(n).
|
void |
writeGEXF(String filename)
Writes the graph as a GEXF file (to be used in Gephi, for example)
|
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values
equals, hashCode, toString
public NeighborList get(Node node)
node
- public void prune(double threshold)
threshold
- public ArrayList<Graph<T>> connectedComponents()
public ArrayList<Graph<T>> stronglyConnectedComponents()
public NeighborList search(Node<T> query, int K, int restarts, int search_depth, SimilarityInterface<T> similarity_measure)
public NeighborList search(Node<T> query, int K, int restarts, int search_depth, SimilarityInterface<T> similarity_measure, int[] computed_similarities)
query
- query pointK
- number of neighbors to find (the K from K-nn search)restarts
- number of random restartssearch_depth
- number of greedy stepssimilarity_measure
- similarity measurecomputed_similarities
- public void writeGEXF(String filename) throws FileNotFoundException, IOException
filename
- FileNotFoundException
IOException
Copyright © 2015. All rights reserved.