On Fri, Feb 15, 2013 at 7:23 PM, km <[email protected]> wrote:
> My code is for directed graphs as defined in Graphs in Computer Science:
>
> http://web.cecs.pdx.edu/~sheard/course/Cs163/Doc/Graphs.html
This is consistent with my intent when I used the phrase.
> However, suppose our undirected graph is
>
> 0--1--2--3 (the only edges are those shown).
>
> Am I right that every set of two nodes is visitable from node 2? These are
I cannot say for sure, because you have not indicated the direction of
the connection. If the connections are all bi-directional, then yes.
But I would have diagramed that something like this:
0<-->1<-->2<-->3
> {0 1} contained in 0--1--2
>
> {0 2} contained in 0--1--2
>
> {0 3} contained in 0--1--2--3
>
> {1 2} contained in 1--2
>
> {1 3} contained in 1--2--3
>
> {2 3} contained in 2--3
>
> ( No order is implied in the conventional set notation {a b} )
I am not sure what you are getting at, here, But I will note that the
relevant visitable sets here (assuming 2-way connections) are:
1 node:
{2}
2 nodes:
{1 2}
{2 3}
3 nodes:
{0 1 2}
{1 2 3}
4 nodes:
{0 1 2 3}
On the other hand if, for example, the connections only went from left
to right, the only visitable sets would be:
1 node:
{2}
2 nodes:
{2 3}
That said, yes - ordering is irrelevant when discussing sets. It's
their construction - determining their contents - where ordering is
relevant.
> Kip
>
> P.S. I do not expect my directed graph code to be efficient for large graphs
> and long chains, but I will experiment and report back.
Thanks!
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm