Class Vertex

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

public class Vertex extends Object
The vertex class for an unweighted graph
Addapted from the CSC2001F notes
See Also:
  • Field Details

    • name

      public String name
      The name of the vertex
    • adjancent

      public List<Vertex> adjancent
      The adjancancy list of the outgoing neighbours
    • dist

      public int dist
      The shortest distance from the source
    • previous

      public Vertex previous
      The predecessor on the path to the source
    • visited

      public boolean visited
      Has the vertex been visited
  • Constructor Details

    • Vertex

      public Vertex(String name)
      Creates a new vertex
      Parameters:
      name - The name of the Vertex
  • Method Details

    • addNeighbour

      public void addNeighbour(Vertex neighbour)
      Adds a neighbour to the adjacency List
      Parameters:
      neighbour - The new neighbour
    • restDist

      public void restDist()
      Resets the distance to the max integer value
    • toString

      public String toString()
      Overrides:
      toString in class Object