[Jprogramming] puzzle: paths in cyclic graphs
Devon McCormick
devonmcc at gmail.com
Wed Feb 13 19:13:21 UTC 2013
Is there anything wrong with just walking the graph and setting each node
visited to 0 while keeping track of where we've been? Once our walk ends,
start again on any remaining node until they're all gone.
On Wed, Feb 13, 2013 at 8:29 AM, Raul Miller <rauldmiller at gmail.com> wrote:
> Let's say that we have a directed, cyclic graph:
>
> graph=: 2 > ?20 20 $ 10
>
> And, let's say that we have a starting node:
>
> start=: 19
>
> And let us define a visitable set as a unique collection of nodes
> reachable from a starting node (in other words, a path connects them).
>
> How can we find the number of distinct visitable sets of a given size
> with a given starting node in a cyclic graph?
>
> Is it worth adjusting the graph so that node 0 is not connected
> (adding 1 to all node indices)?
>
> Thanks,
>
> --
> Raul
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
--
Devon McCormick, CFA
^me^ at acm.
org is my
preferred e-mail
More information about the Programming
mailing list