/** * @see prefuse.data.Edge#getTargetNode() */ public Node getTargetNode() { return m_graph.getTargetNode(this); }
/** * @see prefuse.data.Edge#getTargetNode() */ public Node getTargetNode() { return m_graph.getTargetNode(this); }
/** * Given an edge id and an incident node id, return the node id for * the other node connected to the edge. * @param edge an edge id (edge table row number) * @param node a node id (node table row number). This node id must * be connected to the edge * @return the adjacent node id */ public int getAdjacentNode(int edge, int node) { int s = getSourceNode(edge); int d = getTargetNode(edge); if ( s == node ) { return d; } else if ( d == node ) { return s; } else { throw new IllegalArgumentException( "Edge is not incident on the input node."); } }
/** * Returns an edge from the source node to the target node. This * method returns the first such edge found; in the case of multiple * edges there may be more. */ public int getEdge(int source, int target) { int outd = getOutDegree(source); if ( outd > 0 ) { int[] edges = (int[])m_links.get(source, OUTLINKS); for ( int i=0; i<outd; ++i ) { if ( getTargetNode(edges[i]) == target ) return edges[i]; } } return -1; }
/** * Get the target Node for the given Edge instance. * @param e an Edge instance * @return the target Node of the edge */ public Node getTargetNode(Edge e) { edgeCheck(e, true); return getNode(getTargetNode(e.getRow())); }
/** * Gets the target node of a directed edge. * @param directedEdge spotted edge * @return target node */ public Node getTarget(Edge directedEdge) { int index = this.graph.getTargetNode(directedEdge.getRow()); prefuse.data.Node prefNode = this.graph.getNodeFromKey( this.graph.getKey(index)); return new PrefuseObviousNode(prefNode); }
public void columnChanged(Column src, int idx, long prev) { if ( src==m_scol || src==m_tcol ) { boolean isSrc = src==m_scol; int e = m_edges.getTableRow(idx, isSrc?m_sidx:m_tidx); if ( e == -1 ) return; // edge not in this graph int s = getSourceNode(e); int t = getTargetNode(e); int p = getNodeIndex(prev); if ( p > -1 && ((isSrc && t > -1) || (!isSrc && s > -1)) ) updateDegrees(e, isSrc?p:s, isSrc?t:p, -1); if ( s > -1 && t > -1 ) updateDegrees(e, s, t, 1); } else { throw new IllegalStateException(); } }
/** * Internal method for updating the linkage of this graph. * @param e the edge id for the updated link * @param incr the increment value, 1 for an added link, * -1 for a removed link */ protected void updateDegrees(int e, int incr) { if ( !getEdgeTable().isValidRow(e) ) return; int s = getSourceNode(e); int t = getTargetNode(e); if ( s < 0 || t < 0 ) return; updateDegrees(e, s, t, incr); if ( incr < 0 ) { m_edgeTuples.invalidate(e); } }