go ahead... be a heretic | |
PerlMonks |
Re: Re: Re: Re: Choosing a data structure for AI applicationsby Ovid (Cardinal) |
on Jul 16, 2002 at 16:25 UTC ( [id://182141]=note: print w/replies, xml ) | Need Help?? |
Here's a very simple example that I pulled from http://www.csm.astate.edu/~rossa/cs3543/plect5.html.
Let's say that I want to find all X that is on Y that, in turn, is on Z. I would issue the following query:
Here's how the backtracking works.
This is a trivial example (and I took some shortcuts - see the actual link above), but imagine what happens why we have facts embedded in facts and we need to gain information from those subfacts:
Now, if I issue queries against that (and we're in a proper SQL database), I have at least three tables that I need to span and potentially backtrack across. If my query is more complicated, the number of tables can rise dramatically. You can also read this link for a more complicated example, or an example of how a bad database can lead to infinite recursion with backtracking. Cheers, Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.
In Section
Seekers of Perl Wisdom
|
|