public class SparseSimilarityGraph<V> extends Object implements SimilarityGraph<V>
| Modifier and Type | Class and Description |
|---|---|
static class |
SparseSimilarityGraph.Builder<V> |
| Modifier and Type | Method and Description |
|---|---|
static <V> SparseSimilarityGraph.Builder<V> |
builder(int edgeCapacity) |
boolean |
containsVertex(V vertex)
Returns true if this graph contains
vertex, false otherwise. |
int |
degree(V vertex)
Return the number of edges incident to
vertex. |
com.google.common.base.Optional<SimEdge<V>> |
findEdge(V vertex1,
V vertex2)
Find the edge between
vertex1 and vertex2. |
void |
forEachEdge(Procedure<SimEdge<V>> procedure)
Applies the procedure to each edge in this graph
|
void |
forEachEdge(V vertex,
Procedure<SimEdge<V>> procedure)
Applies the procedure to each edge that is connected to
vertex |
void |
forEachNeighbour(V vertex,
Procedure<V> procedure)
Applies the procedure to each vertex that is a neighbour of
vertex |
void |
forEachVertex(Procedure<V> procedure)
Applies the procedure to each vertex in this graph
|
int |
getEdgeCount()
Returns the number of edges in this graph
|
Iterable<SimEdge<V>> |
getEdges()
Return an Iterable that iterates over the SimEdge's in this graph.
|
Iterable<SimEdge<V>> |
getEdges(V vertex)
Return an Iterable that iterates over all the edges connected to
vertex. |
Collection<V> |
getNeighbors(V vertex)
Return an Iterable that iterates over the neighbours of
vertex. |
int |
getVertexCount()
Return the number of vertexes in this graph.
|
Collection<V> |
getVertices()
Return an Iterable that iterates over the vertices in this graph.
|
public int getVertexCount()
SimilarityGraphgetVertexCount in interface SimilarityGraph<V>public Collection<V> getVertices()
SimilarityGraphgetVertices in interface SimilarityGraph<V>public void forEachVertex(Procedure<V> procedure)
SimilarityGraphforEachVertex in interface SimilarityGraph<V>procedure - a Procedure valuepublic Iterable<SimEdge<V>> getEdges()
SimilarityGraphgetEdges in interface SimilarityGraph<V>public void forEachEdge(Procedure<SimEdge<V>> procedure)
SimilarityGraphforEachEdge in interface SimilarityGraph<V>procedure - a Procedure valuepublic Collection<V> getNeighbors(V vertex)
SimilarityGraphvertex.getNeighbors in interface SimilarityGraph<V>vertex - the vertex whose neighbours are to be iteratedvertexpublic void forEachNeighbour(V vertex, Procedure<V> procedure)
SimilarityGraphvertexforEachNeighbour in interface SimilarityGraph<V>vertex - the vertex whose neighbours are to have the procedure appliedprocedure - a Procedure valuepublic Iterable<SimEdge<V>> getEdges(V vertex)
SimilarityGraphvertex.getEdges in interface SimilarityGraph<V>vertex - the vertex whose edges are to be iteratedvertexpublic void forEachEdge(V vertex, Procedure<SimEdge<V>> procedure)
SimilarityGraphvertexforEachEdge in interface SimilarityGraph<V>vertex - the vertex whose edges are to have the procedure appliedprocedure - a Procedure valuepublic com.google.common.base.Optional<SimEdge<V>> findEdge(V vertex1, V vertex2)
SimilarityGraphvertex1 and vertex2. If there is no edge between
vertex1 and vertex2 an Optional that contains no SimEdge is returned.findEdge in interface SimilarityGraph<V>vertex1 - the start vertexvertex2 - the end vertexvertex1 and vertex2. If no
such edge exists an Optional that contains no reference is returnedpublic int degree(V vertex)
SimilarityGraphvertex.degree in interface SimilarityGraph<V>vertex - the vertex to checkvertexpublic boolean containsVertex(V vertex)
SimilarityGraphvertex, false otherwise.containsVertex in interface SimilarityGraph<V>vertex - the vertex to checkvertex, false otherwisepublic int getEdgeCount()
SimilarityGraphgetEdgeCount in interface SimilarityGraph<V>public static <V> SparseSimilarityGraph.Builder<V> builder(int edgeCapacity)
Copyright © 2016. All Rights Reserved.