Package edu.uci.ics.jung.graph.impl

Examples of edu.uci.ics.jung.graph.impl.DirectedSparseVertex


    queue.add(0,init);
    int i=0;
    int j= queue.size();
    Set<Vertex> done = new HashSet<Vertex>();
    while(i<j){
      DirectedSparseVertex v = (DirectedSparseVertex)queue.get(i);
      done.add(v);
      @SuppressWarnings("unchecked")
      Iterator<Vertex> succIt = v.getSuccessors().iterator();
      while(succIt.hasNext()){
        Vertex succ = succIt.next();
        if(!done.contains(succ))
          queue.add(succ);
      }
View Full Code Here


  }

  /** Creates a graph with a single accept-vertex. */
  public static DirectedSparseGraph initialise(){
    DirectedSparseGraph pta = new DirectedSparseGraph();
    DirectedSparseVertex init = new DirectedSparseVertex();
    init.addUserDatum(JUConstants.INITIAL, true, UserData.SHARED);
    init.addUserDatum(JUConstants.ACCEPTED, true, UserData.SHARED);
    pta.setUserDatum(JUConstants.TITLE, "Hypothesis machine", UserData.SHARED);
    pta.addVertex(init);
    DeterministicDirectedSparseGraph.numberVertices(pta);
    return pta;
  }
View Full Code Here

   * @param reject the name of the reject state, to be added to the graph.
   * @return true if any transitions have been added
   */  
  public static boolean completeGraph(DirectedSparseGraph g, String reject)
  {
    DirectedSparseVertex rejectVertex = new DirectedSparseVertex();
    boolean transitionsToBeAdded = false;// whether and new transitions have to be added.
    rejectVertex.addUserDatum(JUConstants.ACCEPTED, false, UserData.SHARED);
    rejectVertex.addUserDatum(JUConstants.LABEL, reject, UserData.SHARED);
   
    // first pass - computing an alphabet
    Set<String> alphabet = computeAlphabet(g);
   
    // second pass - checking if any transitions need to be added.
View Full Code Here

  }
 
  @Test
  public void testGraphConstructionFail2()
  {
    DirectedSparseVertex v = new DirectedSparseVertex();
    v.addUserDatum(JUConstants.ACCEPTED, true, UserData.SHARED);v.addUserDatum(JUConstants.LABEL, new VertexID("B"), UserData.SHARED);
    checkWithVertex(v, "multiple states with the same name", "testGraphConstructionFail2");
  }
View Full Code Here

  }
 
  @Test
  public void testGraphConstructionFail3()
  {
    DirectedSparseVertex v = new DirectedSparseVertex();
    v.addUserDatum(JUConstants.ACCEPTED, true, UserData.SHARED);v.addUserDatum(JUConstants.LABEL, new VertexID("CONFL"), UserData.SHARED);
    checkWithVertex(v, "multiple states with the same name", "testGraphConstructionFail3");
  }
View Full Code Here

  }
 
  @Test
  public void testGraphConstructionFail4a()
  {
    DirectedSparseVertex v = new DirectedSparseVertex();
    v.addUserDatum(JUConstants.ACCEPTED, true, UserData.SHARED);v.addUserDatum(JUConstants.LABEL, new VertexID("Q"), UserData.SHARED);v.addUserDatum(JUConstants.INITIAL, true, UserData.SHARED);
    checkWithVertex(v, "both labelled as initial states", "testGraphConstructionFail4a");
  }
View Full Code Here

  }
 
  @Test
  public void testGraphConstructionFail4b()
  {
    DirectedSparseVertex v = new DirectedSparseVertex();
    v.addUserDatum(JUConstants.ACCEPTED, true, UserData.SHARED);v.addUserDatum(JUConstants.LABEL, new VertexID("Q"), UserData.SHARED);v.addUserDatum(JUConstants.INITIAL, new VertexID("aa"), UserData.SHARED);
    checkWithVertex(v, "invalid init property", "testGraphConstructionFail4b");
  }
View Full Code Here

  }
 
  @Test
  public void testGraphConstructionFail5a()
  {
    DirectedSparseVertex v = new DirectedSparseVertex();
    v.addUserDatum(JUConstants.ACCEPTED, true, UserData.SHARED);v.addUserDatum(JUConstants.LABEL, new VertexID("Q"), UserData.SHARED);v.addUserDatum(JUConstants.INITIAL, "aa", UserData.SHARED);
    checkWithVertex(v, "invalid init property", "testGraphConstructionFail5a");
  }
View Full Code Here

  }
 
  @Test
  public void testGraphConstructionFail5b()
  {
    DirectedSparseVertex v = new DirectedSparseVertex();
    v.addUserDatum(JUConstants.ACCEPTED, true, UserData.SHARED);v.addUserDatum(JUConstants.LABEL, new VertexID("Q"), UserData.SHARED);v.addUserDatum(JUConstants.INITIAL, false, UserData.SHARED);
    checkWithVertex(v, "invalid init property", "testGraphConstructionFail5b");
  }
View Full Code Here

  /** Unlabelled states. */
  @Test
  public final void testGraphConstructionFail7()
  {
    DirectedSparseVertex v = new DirectedSparseVertex();
    //v.addUserDatum(JUConstants.INITIAL, false, UserData.SHARED);
    v.addUserDatum(JUConstants.ACCEPTED, true, UserData.SHARED);
    checkWithVertex(v, "is not labelled", "testGraphConstructionFail7")
  }
View Full Code Here

TOP

Related Classes of edu.uci.ics.jung.graph.impl.DirectedSparseVertex

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.