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(T query,
int K,
SimilarityInterface<T> similarity_measure,
int max_similarities)
Perform approximate k-nn search on this graph.
|
NeighborList |
search(T query,
int K,
SimilarityInterface<T> similarity_measure,
int max_similarities,
int search_depth,
double expansion)
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(T query, int K, SimilarityInterface<T> similarity_measure, int max_similarities)
query
- K
- search K neighborssimilarity_measure
- max_similarities
- perform max max_similarities similarity computationspublic NeighborList search(T query, int K, SimilarityInterface<T> similarity_measure, int max_similarities, int search_depth, double expansion)
query
- query pointK
- number of neighbors to find (the K from K-nn search)max_similarities
- max similarities to computesearch_depth
- number of greedy steps (default: 100)similarity_measure
- similarity measureexpansion
- (default: 1.01)public void writeGEXF(String filename) throws FileNotFoundException, IOException
filename
- FileNotFoundException
IOException
Copyright © 2015. All rights reserved.