`g = Associative Array();`
`g = Associative Array({1, 2, 4});`
`g = Associative Array({1, 3});`
`g = Associative Array({4, 5});`
`g = Associative Array({4, 5});`
`g = Associative Array({1, 2});`
This is a two-level associative array. The associative array g contains five associative arrays (1, 2, 3, 4, and 5). In the containing array g, both the keys (1-5) and the values (the arrays that define the map) are important. In the inner associative arrays, the values do not matter. Only the keys are important.
 • node 1 is incident on nodes 1, 2, and 4
 • node 2 is incident on nodes 1 and 3
 • node 3 is incident on nodes 4 and 5
 • node 4 is incident on nodes 4 and 5
 • node 5 is incident on nodes 1 and 2
Figure 6.2 Example of a Directed Graph
`dfs = Function( {ref, node, visited},`
`    {chnode, tmp},`
`    Write( "\!NNode: ", node, ", ", ref[node] << Get Keys );`
`    visited[node] = 1;`
`    tmp = ref[node];`
`    chnode = tmp << first;`
`    While( !Is Missing( chnode ),`
`        If( !visited[chnode],`
`            visited = Recurse( ref, chnode, visited )`
`        );`
`        chnode = tmp << Next( chnode );`
`    );`
`    visited;`
`);`
Notes:
 • The first argument is the associative array that contains the map structure.
 • The second argument is the node that you want to use as the starting point.
 • The third argument is a vector that the function uses to keep track of nodes visited.
`dfs( g, 2, J( N Items( g << Get Keys ), 1, 0 ) );`
`Node 2: {1, 3}`
`Node 1: {1, 2, 4}`
`Node 4: {4, 5}`
`Node 5: {1, 2}`
`Node 3: {4, 5}`
`[1, 1, 1, 1, 1]`
 1 Start at node 2 and go to node 1.
 2 From node 1, go to node 4.
 3 From node 4, go to node 5.
 4 From node 5, go back to node 2, and then to node 3.
`New Window( "Directed Graph",`
`	Graph Box(`
`		Frame Size( 300, 300 ),`
`		X Scale( -1.5, 1.5 ),`
`		Y Scale( -1.5, 1.5 ),`
`		Local( {n = N Items( g ), k = 2 * Pi() / n, r, i, pt, from, to,`
`			edge, v, d},`
`			Fill Color( "green" );`
`			Pen Size( 3 );`
`			r = 1 / (n + 2);`
`			For( i = 1, i <= n, i++,`
`				pt = Eval List( {Cos( k * i ), Sin( k * i )} );`
`				edges = g[i];`
`				For( edge = edges << First, !Is Empty( edge ),`
`					edge = edges << Next( edge ),`
`					to = Eval List( {Cos( k * edge ), Sin( k * edge )} );`
`					If( i == edge,`
`						Circle( Eval List( 1.2 * pt ), 0.9 * r ), 	// else`
`						v = pt - to;`
`						d = Sqrt( Sum( v * v ) );`
`						{from, to} = Eval List(`
`							{pt * (d - r) / d + to * r / d, pt * r / d + to *`
`								(d - r) / d}`
`						);`
`						Arrow( from, to );`
`					);`
`				);`
`				Circle( pt, r, "fill" );`
`				Text( Center Justified, pt - {0, 0.05}, Char( i ) );`
`			);`
`		)`
`	)`
`);`

Help created on 7/12/2018