⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 graphtraversal.java

📁 OpenJGraph是一个开源的Java库
💻 JAVA
字号:
package salvo.jesus.graph.algorithm;import salvo.jesus.graph.*;import java.util.*;import java.io.*;/** * Abstract class for an algorithm implementing graph traversal. * Classes implementing the Graph interface uses the Strategy * pattern to allow different implementations of the graph traversal * algorithm to be used. * * Concrete implementations of this class must never modify the Graph itself. */public abstract class GraphTraversal implements Serializable {  static final public int   TERMINATEDBYVISITOR = -1;  static final public int   OK = 1;  /**   * The Graph on which graph traversal will be performed.   */  Graph   graph;  public GraphTraversal( Graph graph ) {    this.graph = graph;  }  /**   * Abstract traversal method to be implemented by subclasses.   *   * @param startat The vertex from which traversal will start.   * @param visitor Visitor object controlling if and when traversal will stop,   *                apart from having visited all the vertices.   * @param visited A List of vertices that has been visited in sequence by the traversal   */  public abstract int traverse( Vertex startat, List visited, Visitor visitor );  /**   * Abstract traversal method to be implemented by subclasses.   *   * @param startat The vertex from which traversal will start.   * @return  A VList of vertices that has been visited in sequence by the traversal   */  public abstract List traverse( Vertex startat );  /**   * Abstract traversal method to be implemented by subclasses.   *   * @param startat The vertex from which traversal will start.   * @param visitor Visitor object controlling if and when traversal will stop,   *                apart from having visited all the vertices.   * @return  A List of vertices that has been visited in sequence by the traversal   */  public abstract List traverse( Vertex startat, Visitor visitor );}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -