Source code: giny/model/GraphPerspective.java
1 package giny.model;
2 import giny.filter.Filter;
3 import java.util.Iterator;
4 import java.util.List;
5 import java.util.NoSuchElementException;
6 import java.util.ArrayList;
7
8 import java.beans.PropertyChangeSupport;
9 import java.beans.PropertyChangeListener;
10
11 import javax.swing.event.EventListenerList;
12
13 public interface GraphPerspective {
14
15
16 /**
17 * Create a new ColtGraphPerspective with the same RootGraph and a new copy
18 * of the rootNodeIndexToPerspectiveNodeIndexMap and
19 * rootEdgeIndexToPerspectiveEdgeIndexMap of this one.
20 * @return a new ColtGraphPerspective with the same Nodes and Edges as this
21 * one.
22 */
23 public Object clone () ;
24
25
26 /**
27 * Return the root Graph for this GraphPerspective
28 * @return the ColtRootGraph root graph object.
29 */
30 public RootGraph getRootGraph () ;
31
32
33 /**
34 * Returns number of active nodes in this perspective.
35 * @return an int value; the number of nodes in this ColtGraphPerspective.
36 */
37 public int getNodeCount () ;
38
39
40 /**
41 * Returns number of active edges in this perspective.
42 * @return an int value; the number of edges in this ColtGraphPerspective.
43 */
44 public int getEdgeCount () ;
45
46
47 /**
48 * @return an Iterator over the Nodes in this graph.
49 */
50 public Iterator nodesIterator () ;
51
52
53 /**
54 * @return a new List containing all of the Nodes in this graph.
55 */
56 public List nodesList () ;
57
58 /**
59 * Return an array containing the indices in the RootGraph of all Nodes in
60 * this GraphPerspective, with each index in the array corresponding to the
61 * index in this GraphPerspective; the first cell's value will always be 0.
62 * <br>
63 * The result should be considered final; it <b>must not</b> be modified by
64 * the receiver.
65 * @return an array containing the indices in the RootGraph of all Nodes in
66 * this GraphPerspective, with each index in the array corresponding to the
67 * index in this GraphPerspective; the first cell's value will always be 0.
68 */
69 public int[] getNodeIndicesArray () ;
70
71 /**
72 * @return an Iterator over the Edges in this graph.
73 */
74 public Iterator edgesIterator () ;
75
76
77 /**
78 * @return a new List containing all of the Edges in this graph.
79 */
80 public List edgesList () ;
81
82 /**
83 * Return an array containing the indices in the RootGraph of all Edges in
84 * this GraphPerspective, with each index in the array corresponding to the
85 * index in this GraphPerspective; the first cell's value will always be 0.
86 * <br>
87 * The result should be considered final; it <b>must not</b> be modified by
88 * the receiver.
89 * @return an array containing the indices in the RootGraph of all Edges in
90 * this GraphPerspective, with each index in the array corresponding to the
91 * index in this GraphPerspective; the first cell's value will always be 0.
92 */
93 public int[] getEdgeIndicesArray () ;
94
95 /**
96 * Return an array of the indices in this GraphPerspective of <B>all</B> edges
97 * between the two nodes given, this will result in three types of edges:
98 * <OL><LI>Undirected Edges</LI>
99 * <LI>Directed Edges from the Source Node to the Target Node</LI>
100 * <LI>Directed Edges from the Target Node to the Source Node</LI>
101 * Depending on the parameters passed, this can be coonfigured.
102 * @param from_node_index the index in this GraphPerspective of the Node to
103 * return edges from.
104 * @param to_node_index the index in this GraphPerspective of the Node to
105 * return edges to.
106 * @param include_undirected_edges Undirected edges will be included in the
107 * array iff include_undirected_edges is true.
108 * @param include_both_directions if this is <B>true</B>, return edges in both
109 * directions, if this is <B>false, only</B> return edges where the source node is
110 * the source.
111 * @return the array of edge indices that was requested.
112 */
113 public int[] getEdgeIndicesArray (
114 int from_node_index,
115 int to_node_index,
116 boolean include_undirected_edges,
117 boolean include_both_directions
118 ) ;
119 /**
120 * If this GraphPerspective does not hide the given Node, change it so that
121 * it does hide the node and all of its incident edges. If the given Node is
122 * not already hidden, this calls {@link
123 * #setRootNodeIndexToPerspectiveNodeIndexMap( OpenIntIntHashMap, boolean,
124 * ChangeEvent )} and {@link #hideAllIncidentEdges(
125 * Node[], Edge[][], ChangeEvent )} and then returns the
126 * given Node after firing the event.
127 * @param node The Node to hide.
128 * @return The given node, unless it was already hidden, in which case
129 * null.
130 * @throws Exception if the given Node is not in the rootGraph.
131 * @see #setRootNodeIndexToPerspectiveNodeIndexMap( OpenIntIntHashMap, boolean,
132 * ChangeEvent )
133 * @see #hideAllIncidentEdges( Node[], Edge[][], ChangeEvent )
134 */
135 public Node hideNode ( Node node ) ;
136
137 /**
138 * If this GraphPerspective does not hide the Node with the given index in
139 * this GraphPerspective, change it so that it does hide the node and all of
140 * its incident edges. If the Node is not already hidden, this calls {@link
141 * #setRootNodeIndexToPerspectiveNodeIndexMap( OpenIntIntHashMap, boolean, ChangeEvent
142 * )} and {@link #hideAllIncidentEdges( int[], int[][],
143 * ChangeEvent )} and then returns the given index after
144 * firing the event.
145 * <br>
146 * This method is implemented to operate without accessing any Node or Edge
147 * objects, and is thus likely to offer the greater efficiency compared to
148 * its non-index counterpart in highly optimized environments.
149 * @param node_index The index in this GraphPerspective of the Node to hide.
150 * @return The given index, unless the corresponding Node was already hidden,
151 * in which case 0.
152 * @see #setRootNodeIndexToPerspectiveNodeIndexMap( OpenIntIntHashMap, boolean,
153 * ChangeEvent )
154 * @see #hideAllIncidentEdges( int[], int[][], ChangeEvent )
155 */
156 public int hideNode ( int node_index ) ;
157
158 /**
159 * If this GraphPerspective does not hide any of the Nodes in the given List,
160 * change it so that it does hide those nodes and all Edges incident on them.
161 * This calls {@link #setRootNodeIndexToPerspectiveNodeIndexMap( OpenIntIntHashMap, boolean,
162 * ChangeEvent )} and {@link #hideAllIncidentEdges( Node[],
163 * Edge[][], ChangeEvent )} with those of the given nodes
164 * that are not already hidden, and then returns them in a List after firing
165 * the event.
166 * @param nodes The List of Nodes to hide.
167 * @return A non-null List containing all of the given nodes that were not
168 * already hidden.
169 * @throws Exception if any of the given Nodes is not in the rootGraph.
170 * @see #setRootNodeIndexToPerspectiveNodeIndexMap( OpenIntIntHashMap, boolean,
171 * ChangeEvent )
172 * @see #hideAllIncidentEdges( Node[], Edge[][], ChangeEvent )
173 */
174 public List hideNodes ( List nodes ) ;
175
176 /**
177 * If this GraphPerspective does not hide any of the Nodes corresponding to
178 * the indices in the given array, change it so that it does hide those nodes
179 * and all Edges incident on them. This calls {@link #setRootNodeIndexToPerspectiveNodeIndexMap(
180 * OpenIntIntHashMap, boolean, ChangeEvent )} and {@link
181 * #hideAllIncidentEdges( Node[], Edge[][], ChangeEvent )}
182 * with those nodes that are not already hidden, and then, after firing the
183 * event, returns an array of equal length to the one given, in which each
184 * corresponding position is either the same as in the argument array or is
185 * 0, indicating that the node with that index was already hidden.
186 * <br>
187 * This method is implemented to operate without accessing any Node or Edge
188 * objects, and is thus likely to offer the greater efficiency compared to
189 * its non-index counterpart in highly optimized environments.
190 * @param node_indices The int array of indices in this GraphPerspective of
191 * the Nodes to hide.
192 * @return An int array of equal length to the argument array, and with equal
193 * values except at positions that in the input array contain indices
194 * corresponding to Nodes that were already hidden; at these positions the
195 * result array will contain the value 0.
196 * @see #setRootNodeIndexToPerspectiveNodeIndexMap( OpenIntIntHashMap, boolean,
197 * ChangeEvent )
198 * @see #hideAllIncidentEdges( int[], int[][], ChangeEvent )
199 */
200 public int[] hideNodes ( int[] node_indices ) ;
201
202 /**
203 * If this GraphPerspective hides the given Node, change it so that it does
204 * not hide the node. If the given Node is presently hidden, this calls
205 * {@link #setRootNodeIndexToPerspectiveNodeIndexMap( OpenIntIntHashMap, boolean,
206 * ChangeEvent )} and then returns the given Node after
207 * firing the event.
208 * @param node The Node to restore.
209 * @return The given node, unless it was not hidden, in which case
210 * null.
211 * @throws Exception if the given Node is not in the rootGraph.
212 * @see #setRootNodeIndexToPerspectiveNodeIndexMap( OpenIntIntHashMap, boolean,
213 * ChangeEvent )
214 */
215 public Node restoreNode ( Node node ) ;
216
217 /**
218 * If this GraphPerspective hides the Node with the given index in this
219 * GraphPerspective, change it so that it does not hide the node. If the
220 * Node is presently hidden, this calls {@link #setRootNodeIndexToPerspectiveNodeIndexMap(
221 * OpenIntIntHashMap, boolean, ChangeEvent )} and then
222 * returns the given index after firing the event.
223 * <br>
224 * This method is implemented to operate without accessing any Node or Edge
225 * objects, and is thus likely to offer the greater efficiency compared to
226 * its non-index counterpart in highly optimized environments.
227 * @param node_index The index in this GraphPerspective of the Node to
228 * restore.
229 * @return The given index, unless the corresponding Node was already
230 * restored, in which case 0.
231 * @see #setRootNodeIndexToPerspectiveNodeIndexMap( OpenIntIntHashMap, boolean,
232 * ChangeEvent )
233 */
234 public int restoreNode ( int node_index ) ;
235
236 /**
237 * If this GraphPerspective hides any of the Nodes in the given List,
238 * change it so that it does not hide those nodes and all Edges incident on
239 * them. This calls {@link #setRootNodeIndexToPerspectiveNodeIndexMap( OpenIntIntHashMap, boolean,
240 * ChangeEvent )} with those of the given nodes that are not
241 * already hidden, and then returns them in a List after firing the event.
242 * @param nodes The List of Nodes to restore.
243 * @return A non-null List containing all of the given nodes that were not
244 * already restored.
245 * @throws Exception if any of the given Nodes is not in the rootGraph.
246 * @see #setRootNodeIndexToPerspectiveNodeIndexMap( OpenIntIntHashMap, boolean,
247 * ChangeEvent )
248 */
249 public List restoreNodes ( List nodes ) ;
250
251 /**
252 * If this GraphPerspective hides any of the Nodes corresponding to the
253 * indices in the given array, change it so that it does not hide those
254 * nodes. This calls {@link #setRootNodeIndexToPerspectiveNodeIndexMap( OpenIntIntHashMap, boolean,
255 * ChangeEvent )} with those nodes that are presently
256 * hidden, and then, after firing the event, returns an array of equal length
257 * to the one given, in which each corresponding position is either the same
258 * as in the argument array or is 0, indicating that the node with that
259 * index was already restored.
260 * <br>
261 * This method is implemented to operate without accessing any Node or Edge
262 * objects, and is thus likely to offer the greater efficiency compared to
263 * its non-index counterpart in highly optimized environments.
264 * @param node_indices The int array of indices in this GraphPerspective of
265 * the Nodes to restore.
266 * @return An int array of equal length to the argument array, and with equal
267 * values except at positions that in the input array contain indices
268 * corresponding to Nodes that were already restored; at these positions the
269 * result array will contain the value 0.
270 * @see #setRootNodeIndexToPerspectiveNodeIndexMap( OpenIntIntHashMap, boolean,
271 * ChangeEvent )
272 */
273 public int[] restoreNodes ( int[] node_indices ) ;
274
275 /**
276 * If this GraphPerspective does not hide the given Edge, change it so that
277 * it does hide the edge. If the given Edge is not already hidden, this
278 * calls {@link #setRootEdgeIndexToPerspectiveEdgeIndexMap( OpenIntIntHashMap, boolean,
279 * ChangeEvent )} and then returns the given Edge after
280 * firing the event.
281 * @param edge The Edge to hide.
282 * @return The given edge, unless it was already hidden, in which case
283 * null.
284 * @throws Exception if the given Edge is not in the rootGraph.
285 * @see #setRootEdgeIndexToPerspectiveEdgeIndexMap( OpenIntIntHashMap, boolean,
286 * ChangeEvent )
287 */
288 public Edge hideEdge ( Edge edge ) ;
289
290 /**
291 * If this GraphPerspective does not hide the Edge with the given index in
292 * this GraphPerspective, change it so that it does hide the edge. If the
293 * Edge is not already hidden, this calls {@link #setRootEdgeIndexToPerspectiveEdgeIndexMap(
294 * OpenIntIntHashMap, boolean, ChangeEvent )} and then
295 * returns the given index after firing the event.
296 * <br>
297 * This method is implemented to operate without accessing any Edge or Edge
298 * objects, and is thus likely to offer the greater efficiency compared to
299 * its non-index counterpart in highly optimized environments.
300 * @param edge_index The index in this GraphPerspective of the Edge to hide.
301 * @return The given index, unless the corresponding Edge was already hidden,
302 * in which case 0.
303 * @see #setRootEdgeIndexToPerspectiveEdgeIndexMap( OpenIntIntHashMap, boolean,
304 * ChangeEvent )
305 */
306 public int hideEdge ( int edge_index ) ;
307
308 /**
309 * If this GraphPerspective does not hide any of the Edges in the given List,
310 * change it so that it does hide those edges. This calls {@link
311 * #setRootEdgeIndexToPerspectiveEdgeIndexMap( OpenIntIntHashMap, boolean, ChangeEvent
312 * )} with those of the given edges that are not already hidden, and then
313 * returns them in a List after firing the event.
314 * @param edges The List of Edges to hide.
315 * @return A non-null List containing all of the given edges that were not
316 * already hidden.
317 * @throws Exception if any of the given Edges is not in the rootGraph.
318 * @see #setRootEdgeIndexToPerspectiveEdgeIndexMap( OpenIntIntHashMap, boolean,
319 * ChangeEvent )
320 */
321 public List hideEdges ( List edges ) ;
322
323 /**
324 * If this GraphPerspective does not hide any of the Edges corresponding to
325 * the indices in the given array, change it so that it does hide those
326 * edges. This calls {@link #setRootEdgeIndexToPerspectiveEdgeIndexMap( OpenIntIntHashMap, boolean,
327 * ChangeEvent )} with those edges that are not already
328 * hidden, and then, after firing the event, returns an array of equal length
329 * to the one given, in which each corresponding position is either the same
330 * as in the argument array or is 0, indicating that the edge with that
331 * index was already hidden.
332 * <br>
333 * This method is implemented to operate without accessing any Edge or Edge
334 * objects, and is thus likely to offer the greater efficiency compared to
335 * its non-index counterpart in highly optimized environments.
336 * @param edge_indices The int array of indices in this GraphPerspective of
337 * the Edges to hide.
338 * @return An int array of equal length to the argument array, and with equal
339 * values except at positions that in the input array contain indices
340 * corresponding to Edges that were already hidden; at these positions the
341 * result array will contain the value 0.
342 * @see #setRootEdgeIndexToPerspectiveEdgeIndexMap( OpenIntIntHashMap, boolean,
343 * ChangeEvent )
344 */
345 public int[] hideEdges ( int[] edge_indices ) ;
346
347 /**
348 * If this GraphPerspective hides the given Edge, change it so that it does
349 * not hide the edge or the Nodes on which the edge is incident. If the
350 * given Edge is presently hidden, this calls {@link #setRootEdgeIndexToPerspectiveEdgeIndexMap(
351 * OpenIntIntHashMap, boolean, ChangeEvent )} and {@link
352 * #restoreAllIncidentNodes( Edge[], Node[][], ChangeEvent
353 * )} and then returns the given Edge after firing the event.
354 * @param edge The Edge to restore.
355 * @return The given edge, unless it was not hidden, in which case
356 * null.
357 * @throws Exception if the given Edge is not in the rootGraph.
358 * @see #setRootEdgeIndexToPerspectiveEdgeIndexMap( OpenIntIntHashMap, boolean,
359 * ChangeEvent )
360 * @see #restoreAllIncidentNodes( Edge[], Node[][], ChangeEvent )
361 */
362 public Edge restoreEdge ( Edge edge ) ;
363
364 /**
365 * If this GraphPerspective hides the Edge with the given index in this
366 * GraphPerspective, change it so that it does not hide the edge or the Nodes
367 * on which the edge is incident. If the Edge is presently hidden, this
368 * calls {@link #setRootEdgeIndexToPerspectiveEdgeIndexMap( OpenIntIntHashMap, boolean,
369 * ChangeEvent )} and {@link #restoreAllIncidentNodes(
370 * int[], int[][], ChangeEvent )} and then returns the given
371 * index after firing the event.
372 * <br>
373 * This method is implemented to operate without accessing any Edge or Edge
374 * objects, and is thus likely to offer the greater efficiency compared to
375 * its non-index counterpart in highly optimized environments.
376 * @param edge_index The index in this GraphPerspective of the Edge to
377 * restore.
378 * @return The given index, unless the corresponding Edge was already
379 * restored, in which case 0.
380 * @see #setRootEdgeIndexToPerspectiveEdgeIndexMap( OpenIntIntHashMap, boolean,
381 * ChangeEvent )
382 * @see #restoreAllIncidentNodes( int[], int[][], ChangeEvent )
383 */
384 public int restoreEdge ( int edge_index ) ;
385
386 /**
387 * If this GraphPerspective hides any of the Edges in the given List, change
388 * it so that it does not hide those edges and all Nodes on which they are
389 * incident. This calls {@link #setRootEdgeIndexToPerspectiveEdgeIndexMap( OpenIntIntHashMap, boolean,
390 * ChangeEvent )} and {@link #restoreAllIncidentNodes(
391 * Edge[], Node[][], ChangeEvent )} with those of the given
392 * edges that are not already hidden, and then returns them in a List after
393 * firing the event.
394 * @param edges The List of Edges to restore.
395 * @return A non-null List containing all of the given edges that were not
396 * already restored.
397 * @throws Exception if any of the given Edges is not in the rootGraph.
398 * @see #setRootEdgeIndexToPerspectiveEdgeIndexMap( OpenIntIntHashMap, boolean,
399 * ChangeEvent )
400 * @see #restoreAllIncidentNodes( Edge[], Node[][], ChangeEvent )
401 */
402 public List restoreEdges ( List edges ) ;
403
404 /**
405 * If this GraphPerspective hides any of the Edges corresponding to the
406 * indices in the given array, change it so that it does not hide those edges
407 * or any of the Nodes on which they are incident. This calls {@link
408 * #setRootEdgeIndexToPerspectiveEdgeIndexMap( OpenIntIntHashMap, boolean, ChangeEvent
409 * )} and {@link #restoreAllIncidentNodes( int[], int[][],
410 * ChangeEvent )} with those edges that are presently
411 * hidden, and then, after firing the event, returns an array of equal length
412 * to the one given, in which each corresponding position is either the same
413 * as in the argument array or is 0, indicating that the edge with that
414 * index was already restored.
415 * <br>
416 * This method is implemented to operate without accessing any Edge or Edge
417 * objects, and is thus likely to offer the greater efficiency compared to
418 * its non-index counterpart in highly optimized environments.
419 * @param edge_indices The int array of indices in this GraphPerspective of
420 * the Edges to restore.
421 * @return An int array of equal length to the argument array, and with equal
422 * values except at positions that in the input array contain indices
423 * corresponding to Edges that were already restored; at these positions the
424 * result array will contain the value 0.
425 * @see #setRootEdgeIndexToPerspectiveEdgeIndexMap( OpenIntIntHashMap, boolean,
426 * ChangeEvent )
427 * @see #restoreAllIncidentNodes( int[], int[][], ChangeEvent )
428 */
429 public int[] restoreEdges ( int[] edge_indices ) ;
430
431 /**
432 * Return true if the given Node is in this GraphPerspective. False
433 * otherwise. This method is recursive, so even if this GraphPerspective
434 * does hide the Node, this method will return true if the given Node is
435 * contained within any non-hidden Node (via the MetaParent->MetaChild
436 * relationship) at any depth. This method calls {@link #containsNode( Node,
437 * boolean ) } with a true <tt>recurse</tt> boolean argument.
438 * @return true iff the given Node is in this GraphPerspective.
439 */
440 public boolean containsNode ( Node node ) ;
441
442 /**
443 * Return true if the given Node is in this GraphPerspective. False
444 * otherwise. If the <tt>recurse</tt> flag is true then this method will be
445 * recursive, so even if this GraphPerspective does hide the Node, this
446 * method will return true if the given Node is contained within any
447 * non-hidden Node (via the MetaParent->MetaChild relationship) at any depth. If
448 * <tt>recurse</tt> is false then this method will return false iff the
449 * given Node is hidden in this GraphPerspective.
450 * @return true iff the given Node is in this GraphPerspective.
451 */
452 public boolean containsNode ( Node node, boolean recurse ) ;
453
454 /**
455 * Return true if the given Edge is in this GraphPerspective. False
456 * otherwise. This method is recursive, so even if this GraphPerspective
457 * does hide the Edge, this method will return true if the given Edge is
458 * contained within any non-hidden Node (via the MetaParent->MetaChild
459 * relationship) at any depth. This method calls {@link #containsEdge( Edge,
460 * boolean ) } with a true <tt>recurse</tt> boolean argument.
461 * @return true iff the given Edge is in this GraphPerspective.
462 */
463 public boolean containsEdge ( Edge edge ) ;
464
465 /**
466 * Return true if the given Edge is in this GraphPerspective. False
467 * otherwise. If the <tt>recurse</tt> flag is true then this method will be
468 * recursive, so even if this GraphPerspective does hide the Edge, this
469 * method will return true if the given Edge is contained within any
470 * non-hidden Node (via the MetaParent->MetaChild relationship) at any depth. If
471 * <tt>recurse</tt> is false then this method will return false iff the
472 * given Edge is hidden in this GraphPerspective.
473 * @return true iff the given Edge is in this GraphPerspective.
474 */
475 public boolean containsEdge ( Edge edge, boolean recurse ) ;
476
477 /**
478 * Creates a union GraphPerspective. The given GraphPerspective must have
479 * the same rootGraph as this one.
480 * @return a new GraphPerspective that contains the union of Nodes and Edges
481 * from this GraphPerspective and the given GraphPerspective.
482 */
483 public GraphPerspective join ( GraphPerspective peer ) ;
484
485 /**
486 * Create a new GraphPerspective with just the given Nodes and Edges (and all
487 * Nodes incident on the given Edges). This implementation simply delegates
488 * to the rootGraph.
489 */
490 public GraphPerspective createGraphPerspective ( Node[] nodes,
491 Edge[] edges
492 );
493
494 /**
495 * Create a new GraphPerspective with just the Nodes with the given
496 * <tt>node_indices</tt> and just the Edges with the given
497 * <tt>edge_indices</tt> (and all Nodes incident on the given Edges). Each
498 * index may be an index in either the RootGraph or this GraphPerspective.
499 * This implementation simply delegates to the rootGraph after converting all
500 * indices to RootGraph indices.
501 */
502 public GraphPerspective createGraphPerspective (int[] node_indices,
503 int[] edge_indices
504 );
505
506 /**
507 * Create a new GraphPerspective with all of the Nodes from this one that
508 * pass the given filter and all of the Edges from this one that pass the
509 * filter (and all Nodes incident on those edges). This implementation
510 * creates a filtered array of Nodes and another of Edges and then calls
511 * {@link #createGraphPerspective( Node[], Edge[] )}.
512 */
513 public GraphPerspective createGraphPerspective ( Filter filter ) ;
514
515 /**
516 * Return a new List of the neighbors of the given Node. If the Node is not
517 * in this perspective, return null. The returned List will include only
518 * those Nodes in this perspective that are the target or source of Edges in
519 * this perspective. If there are any self-edges, Node will be included in
520 * the result.
521 * @return a new List of the neighbors of the given Node
522 */
523 public List neighborsList ( Node node ) ;
524
525 /**
526 * @return Returns an array of neighbor indicies for a given node.
527 */
528 public int[] neighborsArray ( int node_index );
529
530 /**
531 * Determine if there are any Edges in this GraphPerspective between the two
532 * given Nodes.
533 * @return true iff the given Nodes are neighbors in this perspective.
534 */
535 public boolean isNeighbor ( Node a_node, Node another_node ) ;
536
537 /**
538 * Determine if there are any Edges in this GraphPerspective between the two
539 * Nodes with the given indices.
540 * @return true iff the Nodes with the given indices are neighbors in this
541 * perspective.
542 */
543 public boolean isNeighbor ( int a_node_index, int another_node_index ) ;
544
545 /**
546 * Determine if there are any Edges in this GraphPerspective from the first
547 * given Node to the second. If either Node is not in this perspective, the
548 * result will be false.
549 * @param from_node the Node in this GraphPerspective to find edges from.
550 * @param to_node the Node in this GraphPerspective to find edges to.
551 * @return true iff there is at least one Edge in this GraphPerspective with
552 * source <tt>from_node</tt> and target <tt>to_node</tt>.
553 */
554 public boolean edgeExists ( Node from, Node to ) ;
555
556 /**
557 * Determine if there are any Edges in this GraphPerspective from the Node
558 * with the first of the given indices to the Node with the second of the
559 * given indices.
560 * @param from_node_index the index of the Node in this GraphPerspective to
561 * find edges from.
562 * @param to_node_index the index of the Node in this GraphPerspective to
563 * find edges to.
564 * @return true iff there is at least one Edge in this GraphPerspective with
565 * source index <tt>from_node_index</tt> and target index
566 * <tt>to_node_index</tt>.
567 */
568 public boolean edgeExists ( int from_node_index, int to_node_index ) ;
569
570 /**
571 * Count the number of edges from the first Node to the second. Note that if
572 * count_undirected_edges is false, any Edge <tt><i>e</i></tt> such that
573 * <tt><i>e</i>.isDirected() == false</tt> will not be included in the count.
574 * @param from the Node in this GraphPerspective that is the source of the
575 * edges to be counted.
576 * @param to the Node in this GraphPerspective that is the target of the
577 * edges to be counted.
578 * @param count_undirected_edges Undirected edges will be included in the
579 * count iff count_undirected_edges is true.
580 * @return the number of Edges from the <tt>from</tt> Node to the
581 * <tt>to</tt> Node.
582 */
583 public int getEdgeCount (Node from,
584 Node to,
585 boolean count_undirected_edges
586 );
587
588 /**
589 * Count the number of edges from the Node with index <tt>from_index</tt> to
590 * the Node with index <tt>to_index</tt> (where this.getIndex( to_node ) ==
591 * to_index). Note that if count_undirected_edges is false, any Edge
592 * <tt><i>e</i></tt> such that <tt><i>e</i>.isDirected() == false</tt> will
593 * not be included in the count.
594 * @param from_node_index the index in this GraphPerspective of the Node to
595 * count edges from.
596 * @param to_node_index the index in this GraphPerspective of the Node to
597 * find edges to.
598 * @param count_undirected_edges Undirected edges will be included in the
599 * count iff count_undirected_edges is true.
600 * @return the number of Edges from the Node with index <tt>from_index</tt>
601 * to the Node with index <tt>to_index</tt>.
602 */
603 public int getEdgeCount ( int from_node_index,
604 int to_node_index,
605 boolean count_undirected_edges
606 ) ;
607
608 /**
609 * Return a new List of the Edges in this GraphPerspective from the first
610 * given Node to the second given Node.
611 * @param from the Node in this GraphPerspective that is the source of the
612 * Edges to be returned.
613 * @param to the Node in this GraphPerspective that is the target of the
614 * Edges to be returned.
615 * @return a new List of the Edges from the <tt>from</tt> Node to the
616 * <tt>to</tt> Node, or null if none exist or if either Node is not in this
617 * GraphPerspective.
618 */
619 public List edgesList ( Node from, Node to ) ;
620
621 /**
622 * Return an array of the indices in this GraphPerspective of all Edges from
623 * the Node with the first given index to the Node with the second given
624 * index.
625 * @param from_node_index the index in this GraphPerspective of the Node to
626 * return edges from.
627 * @param to_node_index the index in this GraphPerspective of the Node to
628 * return edges to.
629 * @param include_undirected_edges Undirected edges will be included in the
630 * List iff include_undirected_edges is true.
631 * @return a new List of the Edges from the Node corresponding to
632 * <tt>from_node_index</tt> to the Node corresponding to
633 * <tt>to_node_index</tt>, or null if none exist.
634 */
635 public List edgesList (int from_node_index,
636 int to_node_index,
637 boolean include_undirected_edges
638 );
639
640 /**
641 * Return an array of the indices in this GraphPerspective of all Edges from
642 * the Node with the first given index to the Node with the second given
643 * index.
644 * <br>
645 * The result should be considered final; it <b>must not</b> be modified by
646 * the receiver.
647 * @param from_node_index the index in this GraphPerspective of the Node to
648 * return edges from.
649 * @param to_node_index the index in this GraphPerspective of the Node to
650 * return edges to.
651 * @param include_undirected_edges Undirected edges will be included in the
652 * array iff include_undirected_edges is true.
653 * @return an array of the Edges from the Node corresponding to
654 * <tt>from_node_index</tt> to the Node corresponding to
655 * <tt>to_node_index</tt>, or null if none exist.
656 */
657 public int[] getEdgeIndicesArray (int from_node_index,
658 int to_node_index,
659 boolean include_undirected_edges
660 );
661
662 /**
663 * Return the number of Edges <tt><i>e</i></tt> in this GraphPerspective such
664 * that <tt><i>e</i>.getTarget().equals( node )</tt>. Note that this
665 * includes undirected edges, so it will not always be the case that
666 * <tt>getInDegree( node ) + getOutDegree( node ) == getDegree( node )</tt>.
667 * @param node the Node to count in-edges of.
668 * @return the in-degree of the given Node.
669 */
670 public int getInDegree ( Node node ) ;
671
672 /**
673 * Return the number of Edges <tt><i>e</i></tt> in this GraphPerspective such
674 * that <tt><i>e</i>.getTarget().equals( node )</tt>. Note that this
675 * includes undirected edges, so it will not always be the case that
676 * <tt>getInDegree( node ) + getOutDegree( node ) == getDegree( node )</tt>.
677 * @param node_index the index in this GraphPerspective of the Node to count
678 * in-edges of.
679 * @return the in-degree of the Node with the given index.
680 */
681 public int getInDegree ( int node_index ) ;
682
683 /**
684 * Return the number of Edges <tt><i>e</i></tt> in this GraphPerspective
685 * such that <tt><i>e</i>.getSource().equals( node )</tt>. Note that if
686 * count_undirected_edges is true, this includes undirected edges, so it will
687 * not always be the case that <tt>getInDegree( node, true ) + getOutDegree(
688 * node, true ) == getDegree( node )</tt>, but it <i>will</i> always be the
689 * case that <tt>getInDegree( node, true ) + getOutDegree( node, <b>false</b>
690 * ) == getDegree( node )</tt>.
691 * @param node the Node to count in-edges of.
692 * @param count_undirected_edges Undirected edges will be included in the
693 * count iff count_undirected_edges is true.
694 * @return the in-degree of the given Node.
695 */
696 public int getInDegree ( Node node, boolean count_undirected_edges ) ;
697
698 /**
699 * Return the number of Edges <tt><i>e</i></tt> in this GraphPerspective
700 * such that <tt><i>e</i>.getSource().equals( node )</tt>. Note that if
701 * count_undirected_edges is true, this includes undirected edges, so it will
702 * not always be the case that <tt>getInDegree( node, true ) + getOutDegree(
703 * node, true ) == getDegree( node )</tt>, but it <i>will</i> always be the
704 * case that <tt>getInDegree( node, true ) + getOutDegree( node, <b>false</b>
705 * ) == getDegree( node )</tt>.
706 * @param node_index the index in this GraphPerspective of the Node to count
707 * in-edges of.
708 * @param count_undirected_edges Undirected edges will be included in the
709 * count iff count_undirected_edges is true.
710 * @return the in-degree of the Node with the given index.
711 */
712 public int getInDegree ( int node_index, boolean count_undirected_edges ) ;
713
714 /**
715 * Return the number of Edges <tt><i>e</i></tt> in this GraphPerspective such
716 * that <tt><i>e</i>.getSource().equals( node )</tt>. Note that this
717 * includes undirected edges, so it will not always be the case that
718 * <tt>getInDegree( node ) + getOutDegree( node ) == getDegree( node )</tt>.
719 * @param node the Node to count out-edges of.
720 * @return the out-degree of the given Node.
721 */
722 public int getOutDegree ( Node node ) ;
723
724 /**
725 * Return the number of Edges <tt><i>e</i></tt> in this GraphPerspective such
726 * that <tt><i>e</i>.getSource().equals( node )</tt>. Note that this
727 * includes undirected edges, so it will not always be the case that
728 * <tt>getInDegree( node ) + getOutDegree( node ) == getDegree( node )</tt>.
729 * @param node_index the index in this GraphPerspective of the Node to count
730 * out-edges of.
731 * @return the out-degree of the Node with the given index.
732 */
733 public int getOutDegree ( int node_index ) ;
734
735 /**
736 * Return the number of Edges <tt><i>e</i></tt> in this GraphPerspective
737 * such that <tt><i>e</i>.getSource().equals( node )</tt>. Note that if
738 * count_undirected edges is true, this includes undirected edges, so it will
739 * not always be the case that <tt>getInDegree( node, true ) + getOutDegree(
740 * node, true ) == getDegree( node )</tt>, but it <i>will</i> always be the
741 * case that <tt>getInDegree( node, true ) + getOutDegree( node,
742 * <b>false</b> ) == getDegree( node )</tt>.
743 * @param node the Node to count out-edges of.
744 * @param count_undirected_edges Undirected edges will be included in the
745 * count iff count_undirected_edges is true.
746 * @return the out-degree of the given Node.
747 */
748 public int getOutDegree ( Node node, boolean count_undirected_edges ) ;
749
750 /**
751 * Return the number of Edges <tt><i>e</i></tt> in this GraphPerspective
752 * such that <tt><i>e</i>.getSource().equals( node )</tt>. Note that if
753 * count_undirected edges is true, this includes undirected edges, so it will
754 * not always be the case that <tt>getInDegree( node, true ) + getOutDegree(
755 * node, true ) == getDegree( node )</tt>, but it <i>will</i> always be the
756 * case that <tt>getInDegree( node, true ) + getOutDegree( node,
757 * <b>false</b> ) == getDegree( node )</tt>.
758 * @param node_index the index in this GraphPerspective of the Node to count
759 * out-edges of.
760 * @param count_undirected_edges Undirected edges will be included in the
761 * count iff count_undirected_edges is true.
762 * @return the out-degree of the Node with the given index.
763 */
764 public int getOutDegree ( int node_index, boolean count_undirected_edges ) ;
765
766 /**
767 * Return the number of distinct Edges in this GraphPerspective incident on
768 * the given Node. By 'distinct' we mean that no Edge will be counted twice,
769 * even if it is undirected.
770 * @return the degree, in this GraphPerspective, of the given Node.
771 */
772 public int getDegree ( Node node ) ;
773
774 /**
775 * Return the number of distinct Edges in this GraphPerspective incident on
776 * the Node with the given index. By 'distinct' we mean that no Edge will be
777 * counted twice, even if it is undirected.
778 * @return the degree, in this GraphPerspective, of the Node with the given
779 * index.
780 */
781 public int getDegree ( int node_index ) ;
782
783 /**
784 * Return the index of the given Node in this GraphPerspective. If the Node
785 * is hidden in this perspective, the result will be 0. Otherwise each Node
786 * in this perspective is guaranteed to have a unique index in the range 1 to
787 * getNodeCount(), inclusive. Note that if the GraphPerspective
788 * changes in any way then Nodes' indices may change and this method must be
789 * called again to determine the index of the given Node.
790 * @param node the Node to find a corresponding index for.
791 * @return the index of the given Node in this GraphPerspective, or 0 if it
792 * is hidden.
793 */
794 public int getIndex ( Node node ) ;
795
796 /**
797 * Return the index in this GraphPerspective of the Node with the given index
798 * in the RootGraph. If the Node with the given index is hidden in this
799 * perspective, the result will be 0. Otherwise each Node in this
800 * perspective is guaranteed to have a unique index in the range 1 to
801 * getNodeCount(), inclusive. Note that if the GraphPerspective changes in
802 * any way then Nodes' indices may change and this method must be called
803 * again.
804 * @param root_graph_node_index the index in the RootGraph of the Node
805 * @return the index in this GraphPerspective of the node, or 0 if it
806 * is hidden.
807 */
808 public int getNodeIndex ( int root_graph_node_index ) ;
809
810 /**
811 * Return the index in the RootGraph of the Node with the given index
812 * in this GraphPerspective.
813 * @param perspective_node_index the index in this GraphPerspective of the
814 * Node
815 * @return the index in the RootGraph of the Node
816 */
817 public int getRootGraphNodeIndex ( int perspective_node_index ) ;
818
819 /**
820 * Return the Node with the given index in this GraphPerspective. Each index
821 * in this perspective in the range 1 to getNodeCount(), inclusive,
822 * is guaranteed to correspond to a unique Node. Note that if the
823 * GraphPerspective changes in any way then Nodes' indices may change and
824 * this method must be called again to determine the present Node at the
825 * given index.
826 * @param index the index into this GraphPerspective to find a corresponding
827 * Node for.
828 * @return the Node at the given index in this GraphPerspective, or null if
829 * the index is 0.
830 */
831 public Node getNode ( int index ) ;
832
833 /**
834 * Return the index of the given Edge in this GraphPerspective. If the Edge
835 * is hidden in this perspective, the result will be 0. Otherwise each Edge
836 * in this perspective is guaranteed to have a unique index in the range 1 to
837 * getEdgeCount(), inclusive. Note that if the GraphPerspective
838 * changes in any way then Edges' indices may change and this method must be
839 * called again to determine the index of the given Edge.
840 * @param edge the Edge to find a corresponding index for.
841 * @return the index of the given Edge in this GraphPerspective, or 0 if it
842 * is hidden.
843 */
844 public int getIndex ( Edge edge ) ;
845
846 /**
847 * Return the index in this GraphPerspective of the Edge with the given index
848 * in the RootGraph. If the Edge with the given index is hidden in this
849 * perspective, the result will be 0. Otherwise each Edge in this
850 * perspective is guaranteed to have a unique index in the range 1 to
851 * getEdgeCount(), inclusive. Note that if the GraphPerspective changes in
852 * any way then Edges' indices may change and this method must be called
853 * again.
854 * @param root_graph_edge_index the index in the RootGraph of the Edge
855 * @return the index in this GraphPerspective of the edge, or 0 if it
856 * is hidden.
857 */
858 public int getEdgeIndex ( int root_graph_edge_index ) ;
859
860 /**
861 * Return the index in the RootGraph of the Edge with the given index
862 * in this GraphPerspective.
863 * @param perspective_edge_index the index in this GraphPerspective of the
864 * Edge
865 * @return the index in the RootGraph of the Edge
866 */
867 public int getRootGraphEdgeIndex ( int perspective_edge_index ) ;
868
869 /**
870 * Return the Edge with the given index in this GraphPerspective. Each index
871 * in this perspective in the range 1 to getEdgeCount(), inclusive,
872 * is guaranteed to correspond to a unique Edge. Note that if the
873 * GraphPerspective changes in any way then Edges' indices may change and
874 * this method must be called again to determine the present Edge at the
875 * given index.
876 * @param index the index into this GraphPerspective to find a corresponding
877 * Edge for.
878 * @return the Edge at the given index in this GraphPerspective, or null if
879 * the index is 0.
880 */
881 public Edge getEdge ( int index ) ;
882
883 /**
884 * Retrieve the index of the Node that is the source of the Edge with the
885 * given index in this GraphPerspective. Note that if the edge is
886 * undirected, the edge also connects the target to the source.
887 * @param edge_index the index in this GraphPerspective of the Edge
888 * @return the index in this GraphPerspective of the Edge's source Node, or 0
889 * if the Edge is not in this GraphPerspective.
890 */
891 public int getEdgeSourceIndex ( int edge_index ) ;
892
893 /**
894 * Retrieve the index of the Node that is the target of the Edge with the
895 * given index in this GraphPerspective. Note that if the edge is
896 * undirected, the edge also connects the target to the source.
897 * @param edge_index the index in this GraphPerspective of the Edge
898 * @return the index in this GraphPerspective of the Edge's target Node, or 0
899 * if the Edge is not in this GraphPerspective.
900 */
901 public int getEdgeTargetIndex ( int edge_index ) ;
902
903 /**
904 * Retrieve the directedness of the Edge with the given index in this
905 * GraphPerspective. Note that if the edge is undirected, the edge also
906 * connects the target to the source.
907 * @param edge_index the index in this GraphPerspective of the Edge
908 * @return true iff the edge is in this GraphPerspective and is directed
909 */
910 public boolean isEdgeDirected ( int edge_index ) ;
911
912 /**
913 * Nodes and Edges comprise an additional directed-acyclic-graph through the
914 * contains-a relationship, in which a MetaParent Node contains each of its
915 * MetaChild Nodes and Edges. A Node may have any number of MetaParents.
916 * isMetaParent returns true iff the second argument (<tt>parent</tt>) is an
917 * MetaParent of the first argument (<tt>child</tt>). Calls {@link
918 * #isNodeMetaParent( int, int )}.
919 * <br>
920 * Note the inverse relationship between this method and {@link #isMetaChild(
921 * Node, Node )}: <tt>isMetaChild( parent, child ) == isMetaParent( child, parent
922 * )</tt>.
923 * @param child the Node that is the child (the contain<i>ee</i>) in the
924 * contains-a relationship that we are querying.
925 * @param parent the Node that is the parent (the contain<i>er</i>) in the
926 * contains-a relationship that we are querying.
927 * @return true iff the latter argument is a MetaParent of the former argument
928 * in this GraphPerspective.
929 */
930 public boolean isMetaParent ( Node child, Node parent ) ;
931
932 /**
933 * Nodes and Edges comprise an additional directed-acyclic-graph through the
934 * contains-a relationship, in which a MetaParent Node contains each of its
935 * MetaChild Nodes and Edges. A Node may have any number of MetaParents.
936 * isMetaParent returns true iff the Node corresponding to the second argument
937 * (<tt>parent_index</tt>) is a MetaParent of the Node corresponding to the
938 * first argument (<tt>child_index</tt>).
939 * <br>
940 * Note the inverse relationship between this method and {@link
941 * #isNodeMetaChild( int, int )}: <tt>isNodeMetaChild( parent_index, child_index )
942 * == isNodeMetaParent( child_index, parent_index )</tt>.
943 * @param child_node_index the index in this GraphPerspective of the Node
944 * that is the child (the contain<i>ee</i>) in the contains-a relationship
945 * that we are querying.
946 * @param parent_index the index in this GraphPerspective of the Node that is
947 * the parent (the contain<i>er</i>) in the contains-a relationship that we
948 * are querying.
949 * @return true iff the Node corresponding to the latter argument is an
950 * MetaParent (in this GraphPerspective) of the Node corresponding to the former
951 * argument.
952 */
953 public boolean isNodeMetaParent ( int child_node_index, int parent_index ) ;
954
955 /**
956 * Nodes and Edges comprise an additional directed-acyclic-graph through the
957 * contains-a relationship, in which a MetaParent Node contains each of its
958 * MetaChild Nodes and Edges. A Node may have any number of MetaParents.
959 * metaParentsList returns a new List of the MetaParents (in this GraphPerspective)
960 * of the given Node. If there are no MetaParents then the result will be null.
961 * Calls {@link #nodeMetaParentsList( int )}.
962 * @param node the Node that is the child (the contain<i>ee</i>) in the
963 * contains-a relationship that we are querying.
964 * @return a new List of the Nodes in this GraphPerspective that contain the
965 * given Node, or null if the given Node is not in this GraphPerspective or
966 * if there are none.
967 */
968 public List metaParentsList ( Node node ) ;
969
970 /**
971 * Nodes and Edges comprise an additional directed-acyclic-graph through the
972 * contains-a relationship, in which a MetaParent Node contains each of its
973 * MetaChild Nodes and Edges. A Node may have any number of MetaParents.
974 * nodeMetaParentsList returns a new List of the MetaParents (in this
975 * GraphPerspective) of the Node in this GraphPerspective with the given
976 * index. If there are no MetaParents then the result will be null.
977 * @param node_index the index in this GraphPerspective of the Node that is
978 * the child (the contain<i>ee</i>) in the contains-a relationship that we
979 * are querying.
980 * @return a new List of the Nodes in this GraphPerspective that contain the
981 * Node with the given index, or null if the index is 0 or if there are none.
982 */
983 public List nodeMetaParentsList ( int node_index ) ;
984
985 /**
986 * Nodes and Edges comprise an additional directed-acyclic-graph through the
987 * contains-a relationship, in which a MetaParent Node contains each of its
988 * MetaChild Nodes and Edges. A Node may have any number of MetaParents.
989 * getNodeMetaParentIndicesArray returns an array of the MetaParents (in this
990 * GraphPerspective) of the Node with the given index. If there are no
991 * MetaParents then the result will be null.
992 * <br>
993 * The result should be considered final; it <b>must not</b> be modified by
994 * the receiver.
995 * @param node_index the index in this GraphPerspective of the Node that is
996 * the child (the contain<i>ee</i>) in the contains-a relationship that we
997 * are querying.
998 * @return an array of the indices of the Nodes in this GraphPerspective that
999 * contain the Node with the given index, or null if the index is 0 or if
1000 * there are none.
1001 */
1002 public int[] getNodeMetaParentIndicesArray ( int node_index ) ;
1003
1004 /**
1005 * Nodes and Edges comprise an additional directed-acyclic-graph through the
1006 * contains-a relationship, in which a MetaParent Node contains each of its
1007 * MetaChild Nodes and Edges. A Node may have any number of MetaChildren.
1008 * isMetaChild returns true iff the second argument (<tt>child</tt>) is an
1009 * MetaChild of the first argument (<tt>parent</tt>). Calls {@link
1010 * #isNodeMetaChild( int, int )}.
1011 * <br>
1012 * Note the inverse relationship between this method and {@link #isMetaParent(
1013 * Node, Node )}: <tt>isMetaChild( parent, child ) == isMetaParent( child, parent
1014 * )</tt>.
1015 * @param parent the Node that is the parent (the contain<i>er</i>) in the
1016 * contains-a relationship that we are querying.
1017 * @param child the Node that is the child (the contain<i>ee</i>) in the
1018 * contains-a relationship that we are querying.
1019 * @return true iff the latter argument is a MetaChild of the former argument
1020 * in this GraphPerspective.
1021 */
1022 public boolean isMetaChild ( Node parent, Node child ) ;
1023
1024 /**
1025 * Nodes and Edges comprise an additional directed-acyclic-graph through the
1026 * contains-a relationship, in which a MetaParent Node contains each of its
1027 * MetaChild Nodes and Edges. A Node may have any number of MetaChildren.
1028 * isMetaChild returns true iff the Node corresponding to the second argument
1029 * (<tt>child_index</tt>) is a MetaChild of the Node corresponding to the first
1030 * argument (<tt>parent_index</tt>) in this GraphPerspective.
1031 * <br>
1032 * Note the inverse relationship between this method and {@link
1033 * #isNodeMetaParent( int, int )}: <tt>isNodeMetaChild( parent_index, child_index )
1034 * == isNodeMetaParent( child_index, parent_index )</tt>.
1035 * @param parent_index the index in this GraphPerspective of the Node that is
1036 * the parent (the contain<i>er</i>) in the contains-a relationship that we
1037 * are querying.
1038 * @param child_node_index the index in this GraphPerspective of the Node
1039 * that is the child (the contain<i>ee</i>) in the contains-a relationship
1040 * that we are querying.
1041 * @return true iff the Node corresponding to the latter argument is an
1042 * MetaChild (in this GraphPerspective) of the Node corresponding to the former
1043 * argument.
1044 */
1045 public boolean isNodeMetaChild ( int parent_index, int child_node_index ) ;
1046
1047 /**
1048 * Nodes and Edges comprise an additional directed-acyclic-graph through the
1049 * contains-a relationship, in which a MetaParent Node contains each of its
1050 * MetaChild Nodes and Edges. A Node may have any number of MetaChildren.
1051 * nodeMetaChildrenList returns a new List of the MetaChildren (in this
1052 * GraphPerspective) of the given Node. If there are no MetaChildren then the
1053 * result will be null. Calls {@link #nodeMetaChildrenList( int )}.
1054 * @param node the Node that is the parent (the contain<i>er</i>) in the
1055 * contains-a relationship that we are querying.
1056 * @return a new List of the Nodes in this GraphPerspective that are
1057 * contained by the given Node, or null if that Node is not in this
1058 * GraphPerspective or if there are none.
1059 */
1060 public List nodeMetaChildrenList ( Node node ) ;
1061
1062 /**
1063 * Nodes and Edges comprise an additional directed-acyclic-graph through the
1064 * contains-a relationship, in which a MetaParent Node contains each of its
1065 * MetaChild Nodes and Edges. A Node may have any number of MetaChildren.
1066 * nodeMetaChildrenList returns a new List of the Node MetaChildren (in this
1067 * GraphPerspective) of the Node in this GraphPerspective with the given
1068 * index. If there are no MetaChildren then the result will be null.
1069 * @param node_index the index in this GraphPerspective of the Node that is
1070 * the parent (the contain<i>er</i>) in the contains-a relationship that we
1071 * are querying.
1072 * @return a new List of the Nodes in this GraphPerspective that are
1073 * contained by the Node with the given index, or null if the index is 0 or
1074 * if there are none.
1075 */
1076 public List nodeMetaChildrenList ( int parent_index ) ;
1077
1078 /**
1079 * Nodes and Edges comprise an additional directed-acyclic-graph through the
1080 * contains-a relationship, in which a MetaParent Node contains each of its
1081 * MetaChild Nodes and Edges. A Node may have any number of MetaChildren.
1082 * getNodeMetaChildIndicesArray returns an array of the MetaChildren (in this
1083 * GraphPerspective) of the Node with the given index. If there are no
1084 * MetaChildren then the result will be null.
1085 * <br>
1086 * The result should be considered final; it <b>must not</b> be modified by
1087 * the receiver.
1088 * @param node_index the index in this GraphPerspective of the Node that is
1089 * the parent (the contain<i>ee</i>) in the contains-a relationship that we
1090 * are querying.
1091 * @return an array of the indices of the Nodes in this GraphPerspective that
1092 * are contained by the Node with the given index, or null if the index is 0 or if
1093 * there are none.
1094 */
1095 public int[] getNodeMetaChildIndicesArray ( int node_index ) ;
1096
1097 /**
1098 * Nodes and Edges comprise an additional directed-acyclic-graph through the
1099 * contains-a relationship, in which a MetaParent Node contains each of its
1100 * MetaChild Nodes and Edges. An Edge may have any number of MetaParents.
1101 * isMetaParent returns true iff the second argument (<tt>parent</tt>) is an
1102 * MetaParent of the first argument (<tt>child</tt>). Calls {@link
1103 * #isEdgeMetaParent( int, int )}.
1104 * <br>
1105 * Note the inverse relationship between this method and {@link #isMetaChild(
1106 * Node, Edge )}: <tt>isMetaChild( parent, child ) == isMetaParent( child, parent
1107 * )</tt>.
1108 * @param child the Edge that is the child (the contain<i>ee</i>) in the
1109 * contains-a relationship that we are querying.
1110 * @param parent the Node that is the parent (the contain<i>er</i>) in the
1111 * contains-a relationship that we are querying.
1112 * @return true iff the latter argument is a MetaParent of the former argument
1113 * in this GraphPerspective.
1114 */
1115 public boolean isMetaParent ( Edge child, Node parent ) ;
1116
1117 /**
1118 * Nodes and Edges comprise an additional directed-acyclic-graph through the
1119 * contains-a relationship, in which a MetaParent Node contains each of its
1120 * MetaChild Nodes and Edges. An Edge may have any number of MetaParents.
1121 * isMetaParent returns true iff the Node corresponding to the second argument
1122 * (<tt>parent_index</tt>) is a MetaParent of the Edge corresponding to the
1123 * first argument (<tt>child_index</tt>).
1124 * <br>
1125 * Note the inverse relationship between this method and {@link
1126 * #isEdgeMetaChild( int, int )}: <tt>isEdgeMetaChild( parent_index, child_index )
1127 * == isEdgeMetaParent( child_index, parent_index )</tt>.
1128 * @param child_edge_index the index in this GraphPerspective of the Edge
1129 * that is the child (the contain<i>ee</i>) in the contains-a relationship
1130 * that we are querying.
1131 * @param parent_index the index in this GraphPerspective of the Node that is
1132 * the parent (the contain<i>er</i>) in the contains-a relationship that we
1133 * are querying.
1134 * @return true iff the Node corresponding to the latter argument is an
1135 * MetaParent (in this GraphPerspective) of the Edge corresponding to the former
1136 * argument.
1137 */
1138 public boolean isEdgeMetaParent ( int child_edge_index, int parent_index ) ;
1139
1140 /**
1141 * Nodes and Edges comprise an additional directed-acyclic-graph through the
1142 * contains-a relationship, in which a MetaParent Node contains each of its
1143 * MetaChild Nodes and Edges. An Edge may have any number of MetaParents.
1144 * metaParentsList returns a new List of the MetaParents (in this GraphPerspective)
1145 * of the given Edge. If there are no MetaParents then the result will be null.
1146 * Calls {@link #edgeMetaParentsList( int )}.
1147 * @param edge the Edge that is the child (the contain<i>ee</i>) in the
1148 * contains-a relationship that we are querying.
1149 * @return a new List of the Nodes in this GraphPerspective that contain the
1150 * given Edge, or null if the given Edge is not in this GraphPerspective or
1151 * if there are none.
1152 */
1153 public List metaParentsList ( Edge edge ) ;
1154
1155 /**
1156 * Nodes and Edges comprise an additional directed-acyclic-graph through the
1157 * contains-a relationship, in which a MetaParent Node contains each of its
1158 * MetaChild Nodes and Edges. An Edge may have any number of MetaParents.
1159 * EdgeMetaParentsList returns a new List of the MetaParents (in this
1160 * GraphPerspective) of the Edge in this GraphPerspective with the given
1161 * index. If there are no MetaParents then the result will be null.
1162 * @param edge_index the index in this GraphPerspective of the Edge that is
1163 * the child (the contain<i>ee</i>) in the contains-a relationship that we
1164 * are querying.
1165 * @return a new List of the Nodes in this GraphPerspective that contain the
1166 * Edge with the given index, or null if the index is 0 or if there are none.
1167 */
1168 public List edgeMetaParentsList ( int edge_index ) ;
1169
1170 /**
1171 * Nodes and Edges comprise an additional directed-acyclic-graph through the
1172 * contains-a relationship, in which a MetaParent Node contains each of its
1173 * MetaChild Nodes and Edges. An Edge may have any number of MetaParents.
1174 * getEdgeMetaParentIndicesArray returns an array of the MetaParents (in this
1175 * GraphPerspective) of the Edge with the given index. If there are no
1176 * MetaParents then the result will be null.
1177 * <br>
1178 * The result should be considered final; it <b>must not</b> be modified by
1179 * the receiver.
1180 * @param edge_index the index in this GraphPerspective of the Edge that is
1181 * the child (the contain<i>ee</i>) in the contains-a relationship that we
1182 * are querying.
1183 * @return an array of the indices of the Nodes in this GraphPerspective that
1184 * contain the Edge with the given index, or null if the index is 0 or if
1185 * there are none.
1186 */
1187 public int[] getEdgeMetaParentIndicesArray ( int edge_index ) ;
1188
1189 /**
1190 * Nodes and Edges comprise an additional directed-acyclic-graph through the
1191 * contains-a relationship, in which a MetaParent Node contains each of its
1192 * MetaChild Nodes and Edges. A Node may have any number of MetaChildren.
1193 * isMetaChild returns true iff the second argument (<tt>child</tt>) is an
1194 * MetaChild of the first argument (<tt>parent</tt>). Calls {@link
1195 * #isEdgeMetaChild( int, int )}.
1196 * <br>
1197 * Note the inverse relationship between this method and {@link #isMetaParent(
1198 * Edge, Node )}: <tt>isMetaChild( parent, child ) == isMetaParent( child, parent
1199 * )</tt>.
1200 * @param parent the Node that is the parent (the contain<i>er</i>) in the
1201 * contains-a relationship that we are querying.
1202 * @param child the Edge that is the child (the contain<i>ee</i>) in the
1203 * contains-a relationship that we are querying.
1204 * @return true iff the latter argument is a MetaChild of the former argument
1205 * in this GraphPerspective.
1206 */
1207 public boolean isMetaChild ( Node parent, Edge child ) ;
1208
1209 /**
1210 * Nodes and Edges comprise an additional directed-acyclic-graph through the
1211 * contains-a relationship, in which a MetaParent Node contains each of its
1212 * MetaChild Nodes and Edges. A Node may have any number of MetaChildren.
1213 * isMetaChild returns true iff the Edge corresponding to the second argument
1214 * (<tt>child_index</tt>) is a MetaChild of the Node corresponding to the first
1215 * argument (<tt>parent_index</tt>) in this GraphPerspective.
1216 * <br>
1217 * Note the inverse relationship between this method and {@link
1218 * #isEdgeMetaParent( int, int )}: <tt>isEdgeMetaChild( parent_index, child_index )
1219 * == isEdgeMetaParent( child_index, parent_index )</tt>.
1220 * @param parent_index the index in this GraphPerspective of the Node that is
1221 * the parent (the contain<i>er</i>) in the contains-a relationship that we
1222 * are querying.
1223 * @param child_edge_index the index in this GraphPerspective of the Edge
1224 * that is the child (the contain<i>ee</i>) in the contains-a relationship
1225 * that we are querying.
1226 * @return true iff the Edge corresponding to the latter argument is an
1227 * MetaChild (in this GraphPerspective) of the Node corresponding to the former
1228 * argument.
1229 */
1230 public boolean isEdgeMetaChild ( int parent_index, int child_edge_index ) ;
1231
1232 /**
1233 * Nodes and Edges comprise an additional directed-acyclic-graph through the
1234 * contains-a relationship, in which a MetaParent Node contains each of its
1235 * MetaChild Nodes and Edges. A Node may have any number of MetaChildren.
1236 * edgeMetaChildrenList returns a new List of the Edge MetaChildren (in this
1237 * GraphPerspective) of the given Node. If there are no Edge MetaChildren then
1238 * the result will be null. Calls {@link #edgeMetaChildrenList( int )}.
1239 * @param node the Node that is the parent (the contain<i>er</i>) in the
1240 * contains-a relationship that we are querying.
1241 * @return a new List of the Edges in this GraphPerspective that are
1242 * contained by the given Node, or null if that Node is not in this
1243 * GraphPerspective or if there are none.
1244 */
1245 public List edgeMetaChildrenList ( Node node ) ;
1246
1247 /**
1248 * Nodes and Edges comprise an additional directed-acyclic-graph through the
1249 * contains-a relationship, in which a MetaParent Node contains each of its
1250 * MetaChild Nodes and Edges. A Node may have any number of MetaChildren.
1251 * edgeMetaChildrenList returns a new List of the Edge MetaChildren (in this
1252 * GraphPerspective) of the Node in this GraphPerspective with the given
1253 * index. If there are no Edge MetaChildren then the result will be null.
1254 * @param node_index the index in this GraphPerspective of the Node that is
1255 * the parent (the contain<i>er</i>) in the contains-a relationship that we
1256 * are querying.
1257 * @return a new List of the Edges in this GraphPerspective that are
1258 * contained by the Node with the given index, or null if the index is 0 or
1259 * if there are none.
1260 */
1261 public List edgeMetaChildrenList ( int node_index ) ;
1262
1263 /**
1264 * Nodes and Edges comprise an additional directed-acyclic-graph through the
1265 * contains-a relationship, in which a MetaParent Node contains each of its
1266 * MetaChild Nodes and Edges. A Node may have any number of MetaChildren.
1267 * getEdgeMetaChildIndicesArray returns an array of the MetaChildren (in this
1268 * GraphPerspective) of the Node with the given index. If there are no
1269 * MetaChildren then the result will be null.
1270 * <br>
1271 * The result should be considered final; it <b>must not</b> be modified by
1272 * the receiver.
1273 * @param node_index the index in this GraphPerspective of the Node that is
1274 * the parent (the contain<i>ee</i>) in the contains-a relationship that we
1275 * are querying.
1276 * @return an array of the indices of the Edges in this GraphPerspective that
1277 * are contained by the Node with the given index, or null if the index is 0 or if
1278 * there are none.
1279 */
1280 public int[] getEdgeMetaChildIndicesArray ( int node_index ) ;
1281
1282
1283 /**
1284 * Returns all Adjacent Edges to the given node.
1285 * @param node the node
1286 * @param include_undirected_edges should we include undirected edges,
1287 * if true will also return self-edges
1288 * @param include_both_directions should we include both directions of directed edges?
1289 */
1290 public List getAdjacentEdgesList ( Node node, boolean include_undirected_edges, boolean include_both_directions );
1291
1292 /**
1293 * Returns all Adjacent Edges to the given node.
1294 * @param node_index the index of the node
1295 * @param include_undirected_edges should we include undirected edges,
1296 * if true will also return self-edges
1297 * @param include_both_directions should we include both directions of directed edges?
1298 */
1299 public int[] getAdjacentEdgeIndicesArray ( int node_index, boolean include_undirected_edges, boolean include_both_directions );
1300
1301
1302 /**
1303 * This will return an array of edge indices that are the edges between nodes
1304 */
1305 public List getConnectingEdges ( List nodes );
1306
1307 /**
1308 * This will return an array of edge indices that are the edges between nodes
1309 */
1310 public int[] getConnectingEdgeIndicesArray ( int[] node_indices );
1311
1312
1313
1314 /**
1315 * Create a GraphPerspective given a list of nodes. This method
1316 * will automatically find all the interconnected edges.
1317 */
1318 public GraphPerspective createGraphPerspective( int[] node_indices );
1319
1320}