🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

DFS in a collection of computers.

Started by
5 comments, last by alvaro 11 years, 6 months ago
Hi everyone !

I'm a newbie in the field of AI. I am facing a situation where I have a collection of interconnected computers. I want to make a single computer perform a Depth First Search so that I get a list of Traversed nodes (comprising of all the names of the computers in the network). But, each computer is able to communicate only with its immediate neighbours.

The situation is similar to normal DFS Graph Traversal. But, each node has an adjacency list comprising of only the list of immediate neighbours.

Maybe i'm stupid. I can't figure out a way to overcome the situation.

Thanks in advance !

Regards.
Advertisement
I don't think this is so much an (game) AI related problem. A bit of wikipedia delving starting at OSPF might give you some ideas though?
I am no expert in parallelization of algorithms, but my first thought would be to check at the beginning of each node [up to a certain depth] if there are any idle neighbors and split work with them. I would only do that up to certain depth, because the communication overhead would be more than the cost of making a search near the leaves in a single CPU.

I don't think this is so much an (game) AI related problem. A bit of wikipedia delving starting at OSPFmight give you some ideas though?


Depth-first search is used for many things other than shortest path. For instance, it is used in minimax search (which is notoriously hard to parallelize). Perhaps the OP could explain what he is trying to do.

On the other hand, I think this is probably homework.
The reason I mentioned OSPF as a starting point is that it is a routing protocol, which to me seems to be exactly what the OP's problem describes: independent entities requiring their own idea of their network's topology. As I said, the article might serve as inspiration. *shrug*
Each node in the graph contains a list of computers traversed so far. The current computer checks to see if it is on the list. If it is, it returns the list to the caller. If not, it adds its name to the list and then passes a copy of the new list to each of its neighbours.

You want to start with one computer. So, the start computer adds its name to an empty list and calls each of its neighbours with the new list. Then continue as above.

The order that you iterate throught the list and then send will make it BFS or DFS.

This assumes a finite number of computers.
It looks like CS_ and I completely misinterpreted the question. We [or at least I] thought you were trying to use a network of computers to parallelize a DFS of a graph, while you seem to be trying to obtain a list of computers by using DFS in the graph of computers.

Druzil's suggested algorithm seems fine. I would probably only pass the list to neighbors that are not on it, because it's much cheaper to make the check locally than to pass messages around. Also, remember to pass the list back to the caller when you hear back from all your neighbors.


This assumes a finite number of computers.

That's a fairly safe assumption. :)

This topic is closed to new replies.

Advertisement