Lines Matching refs:node

34  * A node in a directed graph.  In addition to an arbitrary
35 * <code>Object</code> containing user data associated with the node,
36 * each node maintains a <code>Set</code>s of nodes which are pointed
37 * to by the current node (available from <code>getOutNodes</code>).
38 * The in-degree of the node (that is, number of nodes that point to
39 * the current node) may be queried.
44 /** The data associated with this node. */
49 * node.
53 /** The in-degree of the node. */
58 * node.
66 /** Returns the <code>Object</code> referenced by this node. */
73 * to by this node.
81 * node is updated and the in-degree of the other node is incremented.
83 * @param node a <code>DigraphNode</code>.
85 * @return <code>true</code> if the node was not previously the
88 public boolean addEdge(DigraphNode node) {
89 if (outNodes.contains(node)) {
93 outNodes.add(node);
94 node.inNodes.add(this);
95 node.incrementInDegree();
100 * Returns <code>true</code> if an edge exists between this node
101 * and the given node.
103 * @param node a <code>DigraphNode</code>.
105 * @return <code>true</code> if the node is the target of an edge.
107 public boolean hasEdge(DigraphNode node) {
108 return outNodes.contains(node);
113 * node is updated and the in-degree of the other node is decremented.
115 * @return <code>true</code> if the node was previously the target
118 public boolean removeEdge(DigraphNode node) {
119 if (!outNodes.contains(node)) {
123 outNodes.remove(node);
124 node.inNodes.remove(this);
125 node.decrementInDegree();
130 * Removes this node from the graph, updating neighboring nodes
136 DigraphNode node = (DigraphNode) inNodesArray[i];
137 node.removeEdge(this);
142 DigraphNode node = (DigraphNode) outNodesArray[i];
143 removeEdge(node);
147 /** Returns the in-degree of this node. */
152 /** Increments the in-degree of this node. */
157 /** Decrements the in-degree of this node. */