/** * Instantiate and return the link table. * @return the created link table */ protected Table createLinkTable() { return LINKS_SCHEMA.instantiate(getNodeTable().getMaximumRow()+1); }
/** * Dispose of this graph. Unregisters this graph as a listener to its * included tables. */ public void dispose() { getNodeTable().removeTableListener(m_listener); getEdgeTable().removeTableListener(m_listener); }
/** * 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())); }
/** * Get the source node id (node table row number) for the given edge * id (edge table row number). * @param edge an edge id (edge table row number) * @return the source node id (node table row number) */ public int getSourceNode(int edge) { return getNodeIndex(getEdgeTable().getLong(edge, m_skey)); }
/** * Get an iterator over all node ids (node table row numbers). * @return an iterator over all node ids (node table row numbers) */ public IntIterator nodeRows() { return getNodeTable().rows(); }
/** * Get an iterator over all edge ids (edge table row numbers). * @return an iterator over all edge ids (edge table row numbers) */ public IntIterator edgeRows() { return getEdgeTable().rows(); }
/** * Remove an edge from the graph. * @param e the Edge to remove from the graph * @return true if the edge was successfully removed, false if the * edge was not found in this graph */ public boolean removeEdge(Edge e) { edgeCheck(e, true); return removeEdge(e.getRow()); }
/** * Get the next sibling of the given node. * @param node a node * @return the next sibling, or null if there is no next sibling */ public Node getNextSibling(Node node) { int n = getNextSiblingRow(node.getRow()); return ( n<0 ? null : getNode(n) ); }
/** * Given a node id (a row number in the node table), get the value of * the node key field. * @param node the node id * @return the value of the node key field for the given node */ public long getKey(int node) { return m_nkey == null ? node : getNodeTable().getLong(node, m_nkey); }
/** * Internal method for clearing the edge table, removing all edges. */ protected void clearEdges() { getEdgeTable().clear(); }
/** * @see prefuse.data.Node#getParent() */ public Node getParent() { return m_graph.getSpanningTree().getParent(this); }
/** * @see prefuse.data.Node#getFirstChild() */ public Node getFirstChild() { return m_graph.getSpanningTree().getFirstChild(this); }
/** * @see prefuse.data.Node#childEdges() */ public Iterator childEdges() { return m_graph.getSpanningTree().childEdges(this); }
/** * Get the child index (order number of the child) for the given parent * and child nodes. * @param p the parent Node * @param c the child Node * @return the index of the child, or -1 if the given child node is not * actually a child of the given parent node, or either node is * invalud. */ public int getChildIndex(Node p, Node c) { return getChildIndex(p.getRow(), c.getRow()); }
/** * @see prefuse.data.Node#getDepth() */ public int getDepth() { return m_graph.getSpanningTree().getDepth(m_row); }
/** * @see prefuse.data.Node#getChildIndex(prefuse.data.Node) */ public int getChildIndex(Node child) { return m_graph.getSpanningTree().getChildIndex(this, child); }
/** * @see prefuse.data.Node#getLastChild() */ public Node getLastChild() { return m_graph.getSpanningTree().getLastChild(this); }
/** * @see prefuse.data.Node#getNextSibling() */ public Node getNextSibling() { return m_graph.getSpanningTree().getNextSibling(this); }