Ahh: Sorry if it looked like a homework question.( I just passed the Turing test) Certainly this is not a homework. This is for the project I am working on. I think that several CPAN modules can do the trick. Ultimately I like to find path from point A to B which can involve multiple pre-defined nodes.
I also like to find out the path where given any 2 nodes to connect, the path should that should be taken have adjacent lists with maximum common elements ( rather than just one ) if possible.
Think of this as DNS routing problem. It is also close to traveling salesman problem. I like to probably learn from the other threads having similar problems.