Class Vertex
java.lang.Object
com.thomas.graphs.DAG.Vertex
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe name of the VertexThe outgoing neighbours of this vertex -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddNeighbour(Vertex neighbour) Adds a neighbour to this vertexbooleanA vertex will be considered equal to another if they have the same namebooleanremoveNeighbour(Vertex neighbour) Removes the edge between this vertex and it's neighbourtoString()
-
Field Details
-
name
The name of the Vertex -
neighbours
-
-
Constructor Details
-
Vertex
Creates a new vertex clasas- Parameters:
name- The name of this vertex- Throws:
IllegalArgumentException- If the name is blank
-
-
Method Details
-
addNeighbour
Adds a neighbour to this vertex- Parameters:
neighbour- The new neighbour- Throws:
IllegalArgumentException- If the neighbour isnull
-
removeNeighbour
Removes the edge between this vertex and it's neighbour- Parameters:
neighbour- The neighbour of the edge that is to be removed- Returns:
- If the neighbour was removed
-
toString
-
equals
-