示例#1
0
  public static Graph reverseGraph(final Graph g) {
    Graph g2 = g;
    for (Iterator it = g.edges(); it.hasNext(); ) {

      Edge e = (Edge) it.next();

      int edgeRow = e.getRow();
      e = g2.getEdge(edgeRow);
      int newTarget = e.getSourceNode().getRow();
      int newSource = e.getTargetNode().getRow();

      e.set(0, new Integer(newSource));
      e.set(1, new Integer(newTarget));
    }

    return g2;
  }
示例#2
0
  public SelfLoopsParallelEdges(final Graph g) {
    HashSet selfLoops = new HashSet();
    HashSet parallelEdges = new HashSet();
    HashMap edges = new HashMap();
    boolean directed = g.isDirected();
    Edge edg;

    for (Iterator it = g.edges(); it.hasNext(); ) {
      edg = (Edge) it.next();

      this.addEdge(edg, directed, selfLoops, parallelEdges, edges);
    }

    selfLoopInfo = this.calculateSelfLoops(selfLoops);
    parallelEdgeInfo = this.calculateParallelEdges(parallelEdges, edges);

    selfLoops = null;
    edges = null;
    parallelEdges = null;
    edg = null;
  }
示例#3
0
 /** @see prefuse.data.Node#edges() */
 public Iterator edges() {
   return m_graph.edges(this);
 }