tempRed = DeterministicDirectedSparseGraph.findInitial(temp);
return tempRed;
}
protected List<List<String>> generateQuestions(DirectedSparseGraph model, DirectedSparseGraph temp, OrigStatePair pair){
Vertex q = pair.getQ();
Vertex r = pair.getR();
if(q==null || r ==null)
return new ArrayList<List<String>>();
DijkstraShortestPath p = new DijkstraShortestPath(temp);
Vertex tempRed = getTempRed(model, r, temp);
Vertex tempInit = DeterministicDirectedSparseGraph.findInitial(temp);
Set<List<String>> prefixes = new HashSet<List<String>>();
if(!tempRed.equals(tempInit)){
List<Edge> prefixEdges = p.getPath(tempInit, tempRed);
prefixes = getPaths(prefixEdges);
}
Set<List<String>> suffixes = computeSuffixes(tempRed, temp);
List<List<String>> questions =new ArrayList<List<String>>();
questions.addAll(mergePrefixWithSuffixes(prefixes, suffixes));
Edge loopEdge = findEdge(tempRed, tempRed);
if(loopEdge!=null){
Collection<String> looplabels = (Collection<String>)loopEdge.getUserDatum(JUConstants.LABEL);
questions.addAll(mergePrefixWithSuffixes(prefixes, looplabels,suffixes));
}
DirectedSparseGraph questionPrefixes = augmentPTA(DeterministicDirectedSparseGraph.initialise(), questions, true);
Iterator<Vertex> questionIt = getEndPoints(questionPrefixes).iterator();
p = new DijkstraShortestPath(questionPrefixes);
questions =new ArrayList<List<String>>();
Vertex init = DeterministicDirectedSparseGraph.findInitial(questionPrefixes);
while(questionIt.hasNext()){
List<Edge> edgePath = p.getPath(init, questionIt.next());
Set<List<String>> pathsToPoint = getPaths(edgePath);
if(pathsToPoint.isEmpty())
continue;
List<String> pathToPoint = (List<String>)getPaths(edgePath).toArray()[0];
Vertex tempV = getVertex(temp, pathToPoint);
Vertex v = getVertex(model, pathToPoint);
if(v == null)
questions.add(pathToPoint);
else if(Test_Orig_RPNIBlueFringeLearner.different(new OrigStatePair(v, tempV)))
questions.add(pathToPoint);