Advertisement

07.16.2008 at 11:08AM PDT, ID: 23570686
[x]
Attachment Details

Recursive function to search an Acyclic graph

Asked by cpeters5 in Perl Programming Language

Tags: perl

I have a simple finite directed acyclic graph (DAG) stored in two tables
-  Nodes (node primary key)
-  Arrows (parent ,  child,  primary key (parent, child))
Both parent and child in the Arrows table are foreign keys referencing the Nodes table.

Each node may occur more than once, i.e. each node may have multiple parents, but there is no cycles in the graph.

I want to write a perl function that read from the two tables and output a string for each full path from the root to a leaf node.

Is this a simple job?  Better yet, is there any code avilable on line somewhere that I can borrow, and perhaps customize to my need?
Thanks,
pac

Start Free Trial
 
 
[+][-]07.16.2008 at 11:14AM PDT, ID: 22018617

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.16.2008 at 11:23AM PDT, ID: 22018689

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.16.2008 at 11:24AM PDT, ID: 22018705

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.16.2008 at 12:31PM PDT, ID: 22019284

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Perl Programming Language
Tags: perl
Sign Up Now!
Solution Provided By: ozo
Participating Experts: 1
Solution Grade: A
 
 
[+][-]07.16.2008 at 01:08PM PDT, ID: 22019641

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.16.2008 at 02:07PM PDT, ID: 22020167

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628