ICSE 2001 Logo   Rigi Logo
 
rcl_node_get_neighbors
Back to RCL Command Index

Argument Default Description
nodeID - Node ID number
arcType - Type of arc to traverse to reach a neighbor
arcDirection - Direction of arc used to reach neighbor (in, out or any)
filterFlag 0 (false) Flag to determine whether or not arc filters are to be used to constrain arc traversal (0 or non-zero)
winNum 0 (active window) Window locale if filterFlag is 1 (true).

Description:

This procedure searches the neighborhood around a reference node, nodeID, in the graph to obtain the ID's of adjacent nodes that satisfy the specified arc traversal criteria. The arcType can be any arc type specified in the domain or any. The arcDirection can specify arcs incoming to the reference node (in), arcs outgoing from the reference node (out), or either (any). If the flag, filterFlag, is true (1), then the arc filters set in the window specified by the winNum argument are used to constrain the neighborhood; only visible (unfiltered) arcs are traversed. If filterflag is false (0), the winNum parameter is ignored. The winNum parameter corresponds to the number in the window title. For example, a window title of "General: 1" has a winNum of one.

Return Value:

A list of node ID's is returned in a null-terminated, printable string with intervening spaces between node ID's. The string can be used as a list in a Tcl script.

Exceptions:

If the nodeId, arcType, arcDirection, or winNum is out of range, a pop-up dialog box displays the error.

Example:

# Given a single selected node, select any nodes in the
# graph that are connected to it through an outgoing
# level arc.

set numnodes [rcl_select_num_nodes]
if { 
numnodes != 1 } {
	puts stderr "Exactly one node must be selected."
	return
}
set nodeid [rcl_select_first_node]
set children [rcl_node_get_neighbors 
nodeid level out]
foreach child 
children {
	rcl_select_id 
child 1
}

Back to RCL Command Index