Class Graph<T>
java.lang.Object
io.github.tigerbotics7125.tigerlib.math.graph.Graph<T>
This class represents a collection of vertecies and edges defining traditional weighted graph.
- Since:
- 2023
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Add an edge to this Graph between two verticies.void
Add an edge to the Graph between two verticies.void
Add an edge to this Graph between two verticies defined by the provided values.void
Add an edge to this Graph between two verticies defined by the provided values.void
Adds the Vertex to this Graph.void
Adds the value as a Vertex to this Graph.boolean
boolean
getSuccessors
(Vertex<T> vertex)
-
Constructor Details
-
Graph
public Graph()Creates a new Graph.
-
-
Method Details
-
getVerticies
- Returns:
- A Stream object of all the verticies in this Graph Object.
-
getSuccessors
- Parameters:
vertex
- Vertex to get successors from.- Returns:
- The successors or neighbors of the given Vertex.
-
contains
- Parameters:
vertexVal
- Value to be searched for.- Returns:
- Whether this Graph contains a Vertex with the given value.
-
contains
- Parameters:
vertex
- Vertex to be searched for.- Returns:
- Whether this Graph contains the provided Vertex.
-
addVertex
Adds the value as a Vertex to this Graph.- Parameters:
vertexVal
- Value to add.
-
addVertex
Adds the Vertex to this Graph.- Parameters:
vertex
- Vertex to add.
-
addEdge
Add an edge to this Graph between two verticies defined by the provided values.- Parameters:
leftVal
- Value of the left Vertex.rightVal
- Value of the right Vertex.weight
- Travel cost between left and right, equal both ways.
-
addEdge
Add an edge to this Graph between two verticies defined by the provided values.- Parameters:
leftVal
- Value of the left Vertex.rightVal
- Value of the right Vertex.weightLR
- Travel cost from left to right.weightRL
- Travel cost from right to left.
-
addEdge
Add an edge to this Graph between two verticies.- Parameters:
left
- Left Vertex.right
- Right Vertex.weight
- Travel cost between left and right, equal both ways.
-
addEdge
Add an edge to the Graph between two verticies.- Parameters:
left
- Left Vertex.right
- Right Vertex.weightLR
- Travel cost from left to right.weightRL
- Travel cost from right to left.
-