|
Posted by Curtis on 12/15/05 06:42
ZeldorBlat <zeldorblat@gmail.com> wrote in message
news:1134537220.700264.55270@g44g2000cwa.googlegroups.com...
>
> Curtis wrote:
>
> > The only way I can presently see to solve the problem is
> > with linked lists, and backwalk the link paths when,
say, E
> > calls B. But I've never worked on this issue before, so
> > maybe there's a simpler algorithm that hasn't occurred
to
> > me?
> >
>
> Well, you basically just described the best algorithm out
there. By
> doing a depth first search of the tree you can detect
cycles pretty
> easily.
That may turn out to be simple. Keep track of the path we're
following, like:
FileA -> FileB --> FileC --> FileD --> File?
If the call to File? is anywhere on that particular path,
that would be a circular call.
I recall working through something not unlike this on a
TreeView component I was writing in Object Pascal some time
back... maybe I can find the code somewhere.
--
Curtis
Visit We the Thinking
www.wethethinking.com
An online magazine/forum
devoted to philosophical
thought.
Navigation:
[Reply to this message]
|