Examples of EdgeIterator


Examples of nz.ac.waikato.jdsl.graph.api.EdgeIterator

    Assert.assertEquals("0", s0.element());
    Assert.assertEquals("1", s1.element());
    Assert.assertEquals("2", s2.element());
    // we must iterate through the edges, because graph.aConnectingEdge
    // does not respect the direction of the edge!
    EdgeIterator iter = graph.edges();
    while (iter.hasNext()) {
      Edge e = iter.nextEdge();
      if (graph.origin(e) == s2 && graph.destination(e) == s0)
        Assert.assertEquals("action0", e.element());
      else if (graph.origin(e) == s2 && graph.destination(e) == s1)
        Assert.assertEquals("action1", e.element());
      else if (graph.origin(e) == s0 && graph.destination(e) == s2)
View Full Code Here

Examples of nz.ac.waikato.jdsl.graph.api.EdgeIterator

    assertEquals("1", s1.element());
    assertEquals("2", s2.element());
    assertEquals(3, listen.getVertexMap().size());
    // we must iterate through the edges, because graph.aConnectingEdge
    // does not respect the direction of the edge!
    EdgeIterator iter = graph.edges();
    while (iter.hasNext()) {
      Edge e = iter.nextEdge();
      if (graph.origin(e) == s2 && graph.destination(e) == s0)
        assertEquals("action0", e.element());
      else if (graph.origin(e) == s2 && graph.destination(e) == s1)
        assertEquals("action1", e.element());
      else if (graph.origin(e) == s0 && graph.destination(e) == s2)
View Full Code Here

Examples of nz.ac.waikato.jdsl.graph.api.EdgeIterator

    PrintWriter output = new PrintWriter(filename);
    String shortName = model_.getModelName();
    shortName = shortName.substring(shortName.lastIndexOf('.')+1);
    output.println("digraph "+shortName);
    output.println("{");
    EdgeIterator edges = fsmGraph_.edges();
    while (edges.hasNext()) {
      Edge e = edges.nextEdge();
      Object origin = fsmGraph_.origin(e).element();
      Object dest = fsmGraph_.destination(e).element();
      String action = (String) e.element();
      output.println("  "+stateName(origin)+" -> "+stateName(dest)
          +"  [label=\""+action+"\"];");
View Full Code Here

Examples of nz.ac.waikato.jdsl.graph.api.EdgeIterator

      printProgress(3, "buildgraph: Added vertex for state "+newState);
    }

    // see if fsmGraph_ already contains this edge.
    boolean present = false;
    EdgeIterator edges = fsmGraph_.connectingEdges(oldVertex, newVertex);
    while (edges.hasNext()) {
      Edge edge = edges.nextEdge();
      if (edge.element().equals(actionName)
          && fsmGraph_.origin(edge) == oldVertex
          && fsmGraph_.destination(edge) == newVertex) {
        present = true;
        break;
View Full Code Here

Examples of nz.ac.waikato.jdsl.graph.api.EdgeIterator

          oldTodo.or(enabled);
      }
    }
    // see if fsmGraph already contains this edge.
    boolean present = false;
    EdgeIterator edges = fsmGraph.connectingEdges(oldVertex, newVertex);
    while (edges.hasNext()) {
      Edge edge = edges.nextEdge();
      if (edge.element().equals(actionName)
          && fsmGraph.origin(edge) == oldVertex
          && fsmGraph.destination(edge) == newVertex) {
        present = true;
        break;
View Full Code Here

Examples of nz.ac.waikato.jdsl.graph.api.EdgeIterator

    PrintWriter output = new PrintWriter(filename);
    String shortName = getModelName();
    shortName = shortName.substring(shortName.lastIndexOf('.')+1);
    output.println("digraph "+shortName);
    output.println("{");
    EdgeIterator edges = fsmGraph.edges();
    while (edges.hasNext()) {
      Edge e = edges.nextEdge();
      Object origin = fsmGraph.origin(e).element();
      Object dest = fsmGraph.destination(e).element();
      String action = (String) e.element();
      output.println("  "+stateName(origin)+" -> "+stateName(dest)
          +"  [label=\""+action+"\"];");
View Full Code Here

Examples of nz.ac.waikato.jdsl.graph.api.EdgeIterator

    PathFinder finder = new PathFinder();
    finder.execute(graph, source, dest);
    if (!finder.pathExists())
      return path;
    else {
      EdgeIterator itr = finder.reportPath();
      while (itr.hasNext()) {
        Edge e = itr.nextEdge();
        Object s = graph.origin(e).element();
        Object d = graph.destination(e).element();
        String action = (String) e.element();
        Transition trans = new Transition(s, action, d);
        path.add(trans);
View Full Code Here

Examples of nz.ac.waikato.jdsl.graph.api.EdgeIterator

    for (int i = 0; i < worth.length; i++) {
      worth[i] = Integer.MIN_VALUE;
    }

    InspectableGraph fsmGraph = graph_.getGraph();
    EdgeIterator edges = fsmGraph.edges();

    // look ahead into the paths that we know about
    // TODO: iterate only over the nodes out of this state
    while (edges.hasNext()) {
      Edge e = edges.nextEdge();
      Object origin = fsmGraph.origin(e).element();
      Object dest = fsmGraph.destination(e).element();
      String actionName = (String) e.element();
      int actionNum = model_.getActionNumber(actionName);
      if (origin.equals(state)) {
View Full Code Here

Examples of nz.ac.waikato.jdsl.graph.api.EdgeIterator

     *
     * @param graph
     *            The GraphListener which contains the explored graph.
     */
    public void preExploredGraph(GraphListener graph) {
        EdgeIterator graphEdges = graph.getGraph().edges();
        VertexInfo src;
        VertexInfo dest;
        seenFirstState = false;
        while (graphEdges.hasNext()) {
            Edge e = graphEdges.nextEdge();
            if (!vertices.containsKey(graph.getGraph().origin(e).element())) {
                src = new VertexInfo(graph.getGraph().origin(e).element());
            } else {
                src = (VertexInfo) vertices.get(graph.getGraph().origin(e).element());
            }
View Full Code Here

Examples of org.gephi.graph.dhns.edge.iterators.EdgeIterator

    }

    //Graph
    public EdgeIterable getEdges() {
        readLock();
        return dhns.newEdgeIterable(new EdgeIterator(structure, new TreeIterator(structure, true, Tautology.instance), false, enabledNodePredicate, Tautology.instance));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.