Class Vertex

java.lang.Object
com.thomas.graphs.DAG.Vertex

public class Vertex extends Object
A vertex class for a DAG
See Also:
  • Field Details

    • name

      public String name
      The name of the Vertex
    • neighbours

      public List<Vertex> neighbours
      The outgoing neighbours of this vertex
  • Constructor Details

  • Method Details

    • addNeighbour

      public void addNeighbour(Vertex neighbour) throws IllegalArgumentException
      Adds a neighbour to this vertex
      Parameters:
      neighbour - The new neighbour
      Throws:
      IllegalArgumentException - If the neighbour is null
    • removeNeighbour

      public boolean removeNeighbour(Vertex neighbour)
      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

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object obj)
      A vertex will be considered equal to another if they have the same name
      Overrides:
      equals in class Object