Package nz.ac.waikato.jdsl.core.ref

Examples of nz.ac.waikato.jdsl.core.ref.NodeSequence


  /**
   * Simple constructor initializes instance variables.
   */
  public DirectedFindCycleDFS() {
    prospectiveCycle_ = new NodeSequence();
    done_ = false;
  }
View Full Code Here


    // Sequence, stepping back along the path until we find the Vertex
    // that closed the cycle.
    //
    // If no cycle is found, the Sequence will be empty and the cycle
    // Iterator will be empty
    Sequence theCycle = new NodeSequence();
    ObjectIterator pathVerts = prospectiveCycle_.elements();
    while (pathVerts.hasNext()) {
      Vertex v = (Vertex)pathVerts.nextObject();
      theCycle.insertFirst(v);
      if (v == cycleStart_) {
  break;
      }
    }
    // remove all decorations added during the DFS
    cleanup();
    // get ready to return the cycle.
    cycleIterator_ = theCycle.elements();
  }
View Full Code Here

  /**
   * Simple constructor initializes instance variables.
   */
  public FindCycleDFS() {
    prospectiveCycle_ = new NodeSequence();
    done_ = false;
  }
View Full Code Here

    // Sequence, stepping back along the path until we find the Vertex
    // that closed the cycle.
    //
    // If no cycle is found, the Sequence will be empty and the cycle
    // Iterator will be empty
    Sequence theCycle = new NodeSequence();
    ObjectIterator pathVerts = prospectiveCycle_.elements();
    while (pathVerts.hasNext()) {
      Vertex v = (Vertex)pathVerts.nextObject();
      theCycle.insertFirst(v);
      if (v == cycleStart_) {
  break;
      }
    }
    // remove all decorations added during the DFS
    cleanup();
    // get ready to return the cycle.
    cycleIterator_ = theCycle.elements();
  }
View Full Code Here

     * <p>
     * O(1)
     */
    public IncidenceListGraph() {
        super();
        allverts_ = new NodeSequence();
        alledges_ = new NodeSequence();
    }
View Full Code Here

    * @exception InvalidEdgeException if an undirected Edge is found
    */
  protected void init(InspectableGraph g) throws InvalidEdgeException{
    graph_ = g;
    NUMBER_KEY_ = new Object();
    queue_ = new NodeSequence();

    //make sure all edges are directed
    EdgeIterator ei = graph_.edges();
    while (ei.hasNext()){
      Edge e = ei.nextEdge();
View Full Code Here

  public EdgeIterator reportPath () throws InvalidQueryException {
    if (!pathExists())
      throw new InvalidQueryException("No path exists between "+source_
              +" and "+dest_);
    else {
      Sequence retval = new NodeSequence();
      Vertex currVertex = dest_;
      while (currVertex != source_) {
  assert isFinished(currVertex);
  Edge currEdge = getEdgeToParent(currVertex);
  assert currEdge != null;
  retval.insertFirst(currEdge);
  currVertex = g_.opposite(currVertex,currEdge);
      }
      return new EdgeIteratorAdapter(retval.elements());
    }
  }
View Full Code Here

TOP

Related Classes of nz.ac.waikato.jdsl.core.ref.NodeSequence

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.