V
 type for vertex objectsE
 type for edge objectspublic interface IGraph<V extends SequenceElement,E extends java.lang.Number>
Modifier and Type  Method and Description 

void 
addEdge(Edge<E> edge)
Add an edge to the graph.

void 
addEdge(int from,
int to,
E value,
boolean directed)
Convenience method for adding an edge (directed or undirected) to graph

int[] 
getConnectedVertexIndices(int vertex)
Return an array of indexes of vertices that the specified vertex is connected to.
Specifically, for undirected graphs return int[] of all X.vertexID() such that (vertex  X) exists For directed graphs, return int[] of all X.vertexID() such that (vertex > X) exists 
java.util.List<Vertex<V>> 
getConnectedVertices(int vertex)
Get a list of all of the vertices that the specified vertex is connected to
Specifically, for undirected graphs return list of all X such that (vertex  X) exists For directed graphs, return list of all X such that (vertex > X) exists 
java.util.List<Edge<E>> 
getEdgesOut(int vertex)
Returns a list of edges for a vertex with a given index
For undirected graphs, returns all edges incident on the vertex
For directed graphs, only returns outward directed edges

Vertex<V> 
getRandomConnectedVertex(int vertex,
java.util.Random rng)
Randomly sample a vertex connected to a given vertex.

Vertex<V> 
getVertex(int idx)
Get a vertex in the graph for a given index

int 
getVertexDegree(int vertex)
Returns the degree of the vertex.
For undirected graphs, this is just the degree. For directed graphs, this returns the outdegree 
java.util.List<Vertex<V>> 
getVertices(int[] indexes)
Get multiple vertices in the graph

java.util.List<Vertex<V>> 
getVertices(int from,
int to)
Get multiple vertices in the graph, with secified indices

int 
numVertices()
Number of vertices in the graph

int numVertices()
Vertex<V> getVertex(int idx)
idx
 integer index of the vertex to get. must be in range 0 to numVertices()java.util.List<Vertex<V>> getVertices(int[] indexes)
indexes
 the indexes of the vertices to retrievejava.util.List<Vertex<V>> getVertices(int from, int to)
from
 first vertex to get, inclusiveto
 last vertex to get, inclusivevoid addEdge(int from, int to, E value, boolean directed)
java.util.List<Edge<E>> getEdgesOut(int vertex)
vertex
 index of the vertex toint getVertexDegree(int vertex)
vertex
 vertex to get degree forVertex<V> getRandomConnectedVertex(int vertex, java.util.Random rng) throws NoEdgesException
vertex
 vertex to randomly sample fromrng
 Random number generator to useNoEdgesException
 thrown if the specified vertex has no edges, or no outgoing edges (in the case
of a directed graph).java.util.List<Vertex<V>> getConnectedVertices(int vertex)
vertex
 Index of the vertexint[] getConnectedVertexIndices(int vertex)
vertex
 index of the vertexgetConnectedVertices(int)