/** A class for vertices of a graph. This class is mutable only in that vertices may be marked or unmarked. Vertices have, in addition to marks, numbers and names that may be accessed. */ public class Vertex { // a numerical index that may be used for // adjacency matrices or adjacency list int number; // a mark that may be used in traversal boolean mark=false; // the name of the vertex String name; /** construct a vertex with a given name and a given index @param s the name */ public Vertex(String s, int n) { name=s; number=n; } /** @return the index of the vertex */ public int getNumber() { return number; } /** @return the name of the given vertex */ public String getName() { return name; } /** @return a string representation of the name of the vertex */ public String toString() { return name; } /** mark the given vertex */ public void mark() { mark=true; } /** unmark the given vertex */ public void unmark() { mark=false; } /** determine whether the vertex is marked */ public boolean isMarked() { return mark; } };