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

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


  DeterministicVertex p = new DeterministicVertex("P"), q= new DeterministicVertex("Q");
  /** Checks that both the old and the new algorithm reports a pair of states as incompatible. */
  public final void testNewLearnerIncompatible(String fsm, String name)
  {
    LearnerGraph s = FsmParser.buildLearnerGraph(fsm, name,testConfig,getLabelConverter());
    DirectedSparseGraph g = s.pathroutines.getGraph();
    OrigStatePair pairOrig = new OrigStatePair(DeterministicDirectedSparseGraph.findVertex(JUConstants.LABEL, VertexID.parseID("B"), g),
        DeterministicDirectedSparseGraph.findVertex(JUConstants.LABEL, VertexID.parseID("A"), g));
    StatePair pairNew = new StatePair(s.findVertex(VertexID.parseID("B")),s.findVertex(VertexID.parseID("A")));
    doneEdges = new HashSet<DirectedSparseEdge>();
    long origScore = computeScore(g, pairOrig),
View Full Code Here


   * @param states being merged are called "A" and "B".
   */
  public final void testNewLearnerQuestions(String fsm, int expectedScore, String learnerName)
  {
    LearnerGraph s = FsmParser.buildLearnerGraph(fsm, learnerName,testConfig,getLabelConverter());
    DirectedSparseGraph g = s.pathroutines.getGraph();
    OrigStatePair pairOrig =
      new OrigStatePair(
          DeterministicDirectedSparseGraph.findVertex(JUConstants.LABEL, VertexID.parseID("B"), g),
          DeterministicDirectedSparseGraph.findVertex(JUConstants.LABEL, VertexID.parseID("A"), g));
    StatePair pairNew1 = new StatePair(s.findVertex(VertexID.parseID("B")),s.findVertex(VertexID.parseID("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

  }
   
  @Test
  public final void testGetTempRed1()
  {
    DirectedSparseGraph a=FsmParser.buildLearnerGraph("A-a->B", "testGetTempRed1 model",config,getLabelConverter()).pathroutines.getGraph(),
      temp=FsmParser.buildLearnerGraph("C-d->Q", "testGetTempRed1 temp",config,getLabelConverter()).pathroutines.getGraph();
    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

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

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

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

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

  /** Each test starts with this configuration. */
  private Configuration mainConfiguration = null;
 
  protected void checkLearner(String fsmString, String name,String [][] plus, String [][] minus)
  {
    final DirectedSparseGraph g = FsmParser.buildGraph(fsmString, name);
    final LearnerGraph expected = new LearnerGraph(g,testConfig);
   
    // now sanity checking on the plus and minus sets
    for(String [] path:plus)
      assert AbstractOracle.USER_ACCEPTED == expected.paths.tracePathPrefixClosed(Arrays.asList(path));
View Full Code Here

  DeterministicVertex p = new DeterministicVertex("P"), q= new DeterministicVertex("Q");
  /** Checks that both the old and the new algorithm reports a pair of states as incompatible. */
  public final void testNewLearnerIncompatible(String fsm, String name)
  {
    DirectedSparseGraph g = FsmParser.buildGraph(fsm, name);
    //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 pairNew = new StatePair(s.findVertex(new VertexID("B")),s.findVertex(new VertexID("A")));
View Full Code Here

  /** 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

TOP

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

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.