Example #1
0
  public void action(GraphData graphData) {
    toInsert.clear();
    GraphModel g = graphData.getGraph();

    AlgorithmUtils.clearVertexMarks(g);
    for (Vertex v : g) {
      subtree.clear();
      aStar(v, v, k, g);
      for (Vertex vv : subtree) vv.setMark(false);
    }
    g.insertEdges(toInsert);
  }
 public Object calculate(GraphData gd) {
   GraphModel graph = gd.getGraph();
   Vector<ArrayDeque<BaseVertex>> maxsets = getMaxIndependentSet(graph);
   Vector<SubGraph> ret = new Vector<SubGraph>();
   for (ArrayDeque<BaseVertex> maxset : maxsets) {
     SubGraph sd = new SubGraph(graph);
     sd.vertices = new HashSet<Vertex>();
     for (BaseVertex v : maxset) {
       sd.vertices.add((Vertex) v);
     }
     ret.add(sd);
   }
   return ret;
 }