V
 type for vertex objectsE
 type for edge objectspublic interface IGraph<V,E>
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.

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 
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,
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.

List<Vertex<V>> 
getVertices(int[] indexes)
Get multiple vertices in the graph

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()List<Vertex<V>> getVertices(int[] indexes)
indexes
 the indexes of the vertices to retrieveList<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)
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, 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).List<Vertex<V>> getConnectedVertices(int vertex)
vertex
 Index of the vertexint[] getConnectedVertexIndices(int vertex)
vertex
 index of the vertexgetConnectedVertices(int)
Copyright © 2020. All rights reserved.