Examples of DirectedSparseGraph


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

  /** Checks that both the old and the two new algorithms report the same score for a pair of states and ask the same questions.
   * @param states being merged are called "A" and "B".
   */
  public final void testNewLearnerQuestions(String fsm, int expectedScore, String learnerName)
  {
    DirectedSparseGraph g = FsmParser.buildGraph(fsm, learnerName);
    //Visualiser.updateFrame(g, null);Visualiser.waitForKey();
    LearnerGraph s = new LearnerGraph(g, testConfig);
    OrigStatePair pairOrig =
      new OrigStatePair(
          DeterministicDirectedSparseGraph.findVertex(JUConstants.LABEL, new VertexID("B"), g),
          DeterministicDirectedSparseGraph.findVertex(JUConstants.LABEL, new VertexID("A"), g));
    StatePair pairNew1 = new StatePair(s.findVertex(new VertexID("B")),s.findVertex(new VertexID("A")));
    DirectedSparseGraph
      temp = mergeAndDeterminize((Graph)g.copy(), pairOrig),
      tempB = MergeStates.mergeAndDeterminize(g, pairNew1,testConfig);
   
    // Now check that ComputeStateScores properly does  mergeAndDeterminize
    // (on the test data we are dealing with in these tests, there are separate tests for mergeAndDeterminize)
View Full Code Here

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

  }
   
  @Test
  public final void testGetTempRed1()
  {
    DirectedSparseGraph a=FsmParser.buildGraph("A-a->B", "testGetTempRed1 model"),
      temp=FsmParser.buildGraph("C-d->Q", "testGetTempRed1 temp");
    Vertex foundA = getTempRed_DijkstraShortestPath(a, DeterministicDirectedSparseGraph.findInitial(a), temp);
    Vertex foundB =Test_Orig_RPNIBlueFringeLearnerTestComponent.getTempRed(a, DeterministicDirectedSparseGraph.findInitial(a), temp);
    Assert.assertTrue(DeterministicDirectedSparseGraph.findInitial(temp).equals(foundA));
    Assert.assertTrue(DeterministicDirectedSparseGraph.findInitial(temp).equals(foundB));
View Full Code Here

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

  }
 
  @Test
  public final void testGetTempRed2()
  {
    DirectedSparseGraph a=FsmParser.buildGraph("A-a->B-a->B-c->C-c->D", "testGetTempRed1 model"),
      temp=FsmParser.buildGraph("C-a->Q-a->Q-c->Q", "testGetTempRed1 temp");
    Vertex foundA = getTempRed_DijkstraShortestPath(a, DeterministicDirectedSparseGraph.findVertex(JUConstants.LABEL, new VertexID("D"), a), temp);
    Vertex foundB = Test_Orig_RPNIBlueFringeLearnerTestComponent.getTempRed(a, DeterministicDirectedSparseGraph.findVertex(JUConstants.LABEL, new VertexID("D"), a), temp);
    Assert.assertTrue(DeterministicDirectedSparseGraph.findVertex(JUConstants.LABEL, new VertexID("Q"), temp).equals(foundA));
    Assert.assertTrue(DeterministicDirectedSparseGraph.findVertex(JUConstants.LABEL, new VertexID("Q"), temp).equals(foundB));
View Full Code Here

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

  }
 
  @Test
  public final void findMergeablePair1()
  {
    DirectedSparseGraph g=FsmParser.buildGraph("A-a->B\nA-b->B\nA-c->C\nA-d->D", "findMergeablePair1");
    Assert.assertNull(Test_Orig_RPNIBlueFringeLearner.findMergablePair(g));
  }
View Full Code Here

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

  }
 
  @Test
  public final void findMergeablePair2()
  {
    DirectedSparseGraph g=FsmParser.buildGraph("A-a->B\nA-b->B\nA-c->D\nA-b->D\nA-d->E", "findMergeablePair2");
    Vertex
      b = DeterministicDirectedSparseGraph.findVertex(JUConstants.LABEL, new VertexID("B"), g),
      d = DeterministicDirectedSparseGraph.findVertex(JUConstants.LABEL, new VertexID("D"), g);
    Set<Vertex> expected = new HashSet<Vertex>();expected.add(d);expected.add(b);
    Set<Vertex> actualA = new HashSet<Vertex>();
View Full Code Here

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

  }
 
  @Test
  public final void findMergeablePair3a()
  {
    DirectedSparseGraph g=FsmParser.buildGraph("S-p->A-a->S\nA-b->S\nA-c->D\nA-b->D\nA-d->E", "findMergeablePair3a");
    Vertex
      s = DeterministicDirectedSparseGraph.findVertex(JUConstants.LABEL, new VertexID("S"), g),
      d = DeterministicDirectedSparseGraph.findVertex(JUConstants.LABEL, new VertexID("D"), g);
    OrigStatePair expected = new OrigStatePair(d,s),
    actualA = Test_Orig_RPNIBlueFringeLearner.findMergablePair(g);
View Full Code Here

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

  }

  @Test
  public final void findMergeablePair3b()
  {
    DirectedSparseGraph g=FsmParser.buildGraph("S-p->A-a->B\nA-b->B\nA-c->S\nA-b->S\nA-d->E", "findMergeablePair3b");
    Vertex
      b = DeterministicDirectedSparseGraph.findVertex(JUConstants.LABEL, new VertexID("B"), g),
      s = DeterministicDirectedSparseGraph.findVertex(JUConstants.LABEL, new VertexID("S"), g);
    OrigStatePair expected = new OrigStatePair(b,s),
    actualA = Test_Orig_RPNIBlueFringeLearner.findMergablePair(g);
View Full Code Here

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

  }

  @Test
  public final void findMergeablePair4()
  {
    DirectedSparseGraph g=FsmParser.buildGraph("S-p->A-a->B\nA-b->B\nA-c-#D\nA-b-#D\nA-d->E", "findMergeablePair4");
    OrigStatePair actualA = Test_Orig_RPNIBlueFringeLearner.findMergablePair(g);
    Assert.assertNull(actualA);
  }
View Full Code Here

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

   * be false.
   */
  public void checkCorrectnessOfMerging(String machineToMerge, String expectedFSM,
      String stateBlue, String stateRed, String graphName, boolean checkWithEquals)
  {
    DirectedSparseGraph g=FsmParser.buildGraph(machineToMerge, graphName),
      g2=(DirectedSparseGraph)g.copy();
    Vertex
      a = DeterministicDirectedSparseGraph.findVertex(JUConstants.LABEL, new VertexID(stateRed), g),
      b = DeterministicDirectedSparseGraph.findVertex(JUConstants.LABEL, new VertexID(stateBlue), g);
       
    Assert.assertNotNull("state "+stateRed+" was not found", a);
View Full Code Here

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

  }

  @Test
  public final void testMerge1a()
  {
    DirectedSparseGraph g=FsmParser.buildGraph("S-p->A-a->S\nA-b->S\nA-c->D\nA-b->D\nA-d->E\nS-n->U", "testMerge1a");
    Vertex
      s = DeterministicDirectedSparseGraph.findVertex(JUConstants.LABEL, new VertexID("S"), g),
      d = DeterministicDirectedSparseGraph.findVertex(JUConstants.LABEL, new VertexID("U"), g);
    OrigStatePair pair = new OrigStatePair(d,s);
    LearnerGraph
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.