Class Graph
java.lang.Object
com.thomas.graphs.Weighted.Graph
An implenation of a graph that has weighted edges
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidCreates a new directional edge between a source vertex and a destinationvoidAdds a vertex to the graphvoidbellmanFord(Vertex source) An implemntation of Bellman Ford's algorithmvoidAn implemntation of Dijsktra's Algorithm
-
Field Details
-
INFINITY
public static final int INFINITYA quick reference for "Infinity"- See Also:
-
vertices
-
-
Constructor Details
-
Graph
public Graph()Creates an empty graph
-
-
Method Details
-
addVertex
-
addEdge
-
dijkstra
An implemntation of Dijsktra's Algorithm- Parameters:
source- The source vertex- Throws:
IllegalArgumentException- If any of the weights are negative
-
bellmanFord
An implemntation of Bellman Ford's algorithm- Parameters:
source- The source vertex- Throws:
NegativeCycleException- if a negative Cycle is detected
-