Exemple #1
0
 public Graph<v, e> copyGraph(Graph<v, e> in) {
   Graph<v, e> copy = new Graph<v, e>(Edge.class);
   for (Vertex v : in.vertexSet()) {
     copy.addV(v);
   }
   for (Edge e : in.edgeSet()) {
     copy.addE(e);
   }
   return copy;
 }
Exemple #2
0
  /**
   * Copy a graph into the Graph structure
   *
   * @param g
   */
  public void copyInGraph(Graph<Vertex, Edge> g) {
    if (this.subGraphs.contains(g.name)) {
      return;
    }

    for (Vertex v : g.vertexSet()) {
      this.addV(v);
    }
    for (Edge e : g.edgeSet()) {
      this.addE(e);
    }
    this.subGraphs.add(g.name);
    if (!allGraphs.containsKey(g.name)) {
      allGraphs.put(g.name, g);
    }
  }