Class Vertex

java.lang.Object
com.thomas.graphs.Weighted.Vertex
All Implemented Interfaces:
Comparable<Vertex>

public class Vertex extends Object implements Comparable<Vertex>
A simple implentation of a vertex class with weighted edges
See Also:
  • Field Details

    • name

      public String name
      The name of the vertex
    • outgoing

      public List<Edge> outgoing
      The list of outgoing weighted edges
    • distance

      public int distance
      The best known distance
    • previous

      public Vertex previous
      The previous vertex
    • visited

      public boolean visited
      The proccessed flag
    • scractch

      public int scractch
      A scratch marker
  • Constructor Details

    • Vertex

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

    • reset

      public void reset()
      Resets the vertex for running searching algorithms
    • AddEdge

      public void AddEdge(Vertex destination, int weight)
      Adds a new outgoing edge to the Vertex
      Parameters:
      destination - The destination vertex
      weight - The weight
    • compareTo

      public int compareTo(Vertex o)
      Specified by:
      compareTo in interface Comparable<Vertex>