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;
 }
示例#2
0
 static void completeEdges(SubGraph reminder) {
   for (VertexModel v : reminder.vertices) {
     for (VertexModel u : reminder.vertices) {
       if (u.getId() > v.getId())
         if (SubGraph.getEdge(reminder, u, v) == null) {
           Integer w = TripNet.getW(TripNet.Xi(u), TripNet.Xi(v));
           if (w != null) {
             EdgeModel e = new EdgeModel(u, v);
             e.setWeight(w);
             reminder.graph.insertEdge(e);
             reminder.edges.add(e);
           }
         }
     }
   }
 }