Esempio n. 1
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);
           }
         }
     }
   }
 }
Esempio n. 2
0
 public static GraphModel getACopy(GraphModel g) {
   GraphModel ret = new GraphModel(g.isDirected());
   VertexModel[] map = new VertexModel[g.getVerticesCount()];
   for (VertexModel v : g) {
     VertexModel t = new VertexModel(v);
     map[v.getId()] = t;
     ret.insertVertex(t);
   }
   for (EdgeModel e : g.edges()) {
     EdgeModel t = new EdgeModel(e, map[e.source.getId()], map[e.target.getId()]);
     ret.insertEdge(t);
     setDup(e, t);
   }
   return ret;
 }