Class Graph
java.lang.Object
com.thomas.graphs.Unweighted.Graph
An implenation of a graph that does not have weighted edges
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionGraph()Creates an empty graphGraph(LinkedList<Vertex> vertices) Creates a new graph with vertices -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a directional edge between two verticevoidaddUndirectedEdge(Vertex source, Vertex destination) Adds an undirected edge between two verticesvoidAdds a vertex to the graphvoidAn implemnetaion of the breadth-first search algorithmvoidAn implemnetation of the depth-first search algorithmvoidrecursiveDFS(Vertex vertex) The recusersice defintion of the DFS 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 -
Graph
Creates a new graph with vertices- Parameters:
vertices- The vertices in the graph
-
-
Method Details
-
addVertex
Adds a vertex to the graph- Parameters:
vertex- The vertex to be added to the graph
-
addEdge
-
addUndirectedEdge
-
bfs
An implemnetaion of the breadth-first search algorithm- Parameters:
source- The source vertex
-
dfs
An implemnetation of the depth-first search algorithm- Parameters:
source- The source vertex
-
recursiveDFS
The recusersice defintion of the DFS algorithm- Parameters:
vertex- The current vertex
-