Package com.javaholics
Class Vertex
java.lang.Object
com.javaholics.Vertex
Represents a vertex in a graph.
Each vertex maintains a list of its adjacent vertices.
The graph is undirected, meaning that an edge between two vertices goes both
ways.
- Author:
- Lindsay Kislingbury, Lea Wiranatha
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addAdjacentVertex
(Vertex vertex) Adds a vertex to the list of adjacent vertices.Returns a list of the vertices adjacent to this vertex.getLabel()
Returns the label of this vertex.
-
Constructor Details
-
Vertex
Constructs a new vertex with the given label.- Parameters:
label
- The label of the vertex.
-
-
Method Details
-
getLabel
Returns the label of this vertex.- Returns:
- The label of this vertex.
-
getAdjacentVertices
Returns a list of the vertices adjacent to this vertex.- Returns:
- A list of the vertices adjacent to this vertex.
-
addAdjacentVertex
Adds a vertex to the list of adjacent vertices.- Parameters:
vertex
- The vertex to add as an adjacent vertex.
-