- Type Parameters:
T
- the type of vertex in this graph
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
An interface for weighted directed graph (network)
- Since:
- 1.1
-
Method Summary
Modifier and TypeMethodDescriptionReturns the edges of the given vertex, ornull
if this graph contains no given vertex.default double
getDistance
(List<T> path) Calculate the distance for the given pathstatic <T> Graph<T>
Creates a Graph object by given schema.schema()
The schema of this graph.
-
Method Details
-
schema
The schema of this graph. In a graph schema, each vertex is assigned an edge map. If the vertex has no edges, then it should be assigned an empty map.- Returns:
- the graph scheme
-
edges
Returns the edges of the given vertex, ornull
if this graph contains no given vertex.A return value of
null
does not necessarily indicate that the specified vertex is not present in the graph; it's also possible that in the graph schema,null
was specified for the edges of this vertex instead of an empty map.- Parameters:
vertex
- vertex- Returns:
- all links for the given vertex or null if no such vertex in the graph
-
getDistance
Calculate the distance for the given path- Parameters:
path
- the list of vertices representing the path- Returns:
- distance for the given path as double
- Throws:
NullPointerException
- ifpath
is incorrect and contains more than one vertex
-
of
Creates a Graph object by given schema. In a graph schema, each vertex is assigned an edge map. If the vertex has no edges, then it should be assigned an empty map.- Type Parameters:
T
- the type of vertex in this graph- Parameters:
schema
- of the graph- Returns:
- graph object with given schema
-