Exemplo n.º 1
0
 public Node whatNodeIGetTo(Node from, Transition with) {
   for (Edge e : myGraph.edgeSet()) {
     if (e.getSource().equals(from) && e.getTransition().equals(with)) {
       return e.getDest();
     }
   }
   return null;
 }
Exemplo n.º 2
0
 private Graph buildGraph(List<Edge> edges) {
   Graph toReturn = new Graph();
   for (Edge e : edges) {
     toReturn.addNode(e.getSource());
     toReturn.addNode(e.getDest());
     toReturn.addEdge(e);
   }
   return toReturn;
 }
Exemplo n.º 3
0
 public List<Graph> getAllNodeCoverage() {
   Node initial = getInitialState();
   Set<Node> toVisit = new HashSet<>(nodes);
   toVisit.remove(initial);
   Set<Node> left = new HashSet<>(nodes);
   left.remove(initial);
   List<Graph> toReturn = new ArrayList<>();
   for (Node visiting : toVisit) {
     if (left.contains(visiting)) {
       DijkstraShortestPath<Node, Edge> pathFinder =
           new DijkstraShortestPath<>(myGraph, initial, visiting);
       List<Edge> path = pathFinder.getPathEdgeList();
       for (Edge e : path) {
         left.remove(e.getDest());
       }
       toReturn.add(buildGraph(path));
     }
   }
   return toReturn;
 }
Exemplo n.º 4
0
 public void addEdge(Edge toAdd) {
   myGraph.addEdge(toAdd.getSource(), toAdd.getDest(), toAdd);
 }