Package vg.core.graph

Examples of vg.core.graph.Vertex


  }
  public int getStorableId() {
    return(this.storableId);
  }
  public synchronized Vertex getVertex() {
    Vertex v = new Vertex(this.id);
    for(StorableAttribute bufAttribte : this.attributes) {
      v.addAttribute(bufAttribte.getName(), bufAttribte.getValue());       
    }
    v.setInnerGraph(this.innerGraphId);
    return(v);
  }
View Full Code Here


    HashMap<Integer, Vertex>localVertex = new HashMap<Integer, Vertex>();
    ArrayList<Edge>localEdge = new ArrayList<Edge>();
    ArrayList<Vertex>twoLocalVertex = new ArrayList<Vertex>();
    //vertices-------------------------------
    for(StorableVertex bufVertex : this.vertices) {
      Vertex v = bufVertex.getVertex();
      localVertex.put(bufVertex.getStorableId(), v);
      twoLocalVertex.add(v);
    }
    //edges----------------------------------
    for(StorableEdge bufEdge : this.edges) {
      Vertex source = localVertex.get(bufEdge.getStorableSource().getStorableId());
      Vertex target = localVertex.get(bufEdge.getStorableTarget().getStorableId());
      localEdge.add(new Edge(source, target, bufEdge.getId(), bufEdge.getAttributes()));
    }
    SubGraph sg = new SubGraph(this.id, this.name, twoLocalVertex, localEdge, this.directed);
    return(sg);
  }
View Full Code Here

   * @throws CoreException
   */
  public static Graph generate(int number) throws CoreException {
    ArrayList<Vertex> v = new ArrayList<Vertex>();
    ArrayList<Edge> e = new ArrayList<Edge>();
    Vertex p1 = null;
    Vertex p2 = null;
    Vertex curr = null;
    int c = 0;
   
    for (int i = 0; i< number; i++,p2 = p1, p1 = curr) {
      curr = new Vertex("H"+i);
      if (i == number -1 )
        curr.setInnerGraph(1);
      v.add(curr);
      if (p1 == null)
        continue;
      e.add(new Edge(curr, p1,"e" + c));
      if (p2 == null)
        continue;
      e.add(new Edge(curr, p2, "e" + (c+1)));
      c += 2;
    }
    SubGraph sg1 = new SubGraph(null,v, e, true);
   
    ArrayList<Vertex> v2 = new ArrayList<Vertex>();
    ArrayList<Edge> e2 = new ArrayList<Edge>();
   
    Vertex t1 = new Vertex("S");
    v2.add(t1);
    Vertex t2 = new Vertex("T");
    v2.add(t2);
    e2.add(new Edge(t1, t2, "e"+c));
    SubGraph sg2 = new SubGraph(null,v2, e2, true);
   
    Graph g = new Graph();
View Full Code Here

TOP

Related Classes of vg.core.graph.Vertex

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.