Exemple #1
0
 /**
  * Method to return the unvisited edge for the Graph
  *
  * @param n : Input vertex for which the unvisited Edges are to be determined.
  * @return : Returns the unvisited Edges for the input Vertex.
  */
 public static Edge getUnvisitedEdge(Vertex n) {
   for (Edge e : n.Adj) {
     if (e.visited == false && e.From.equals(n)) {
       e.visited = true;
       return e;
     }
   }
   return null;
 }
Exemple #2
0
 /**
  * Utility Method to determine if the Vertex has unvisited children
  *
  * @param n : Input vertex for which the children are to be determined.
  * @return : Returns the unvisited child Vertex for the input Vertex.
  */
 public static Vertex getUnvisitedChildren(Vertex n) {
   for (Edge e : n.Adj) {
     if (e.visited == false && e.From.equals(n)) {
       e.visited = true;
       return e.To;
     }
   }
   return null;
 }