php problem , help please ?

Person X

New member
hi there , i am stuck with this problem and need some helpful pointers (so please be patient) , i have the following nodes :

array( 'L1' => array ('L2' , 'L7' , 'L8') ,
'L2' => array( 'L1' , 'L8' , 'L7' ) ,
'L3' =>array( 'L4' , 'L5' , 'L7' ) ,
'L4' => array( 'L3' , 'L5' , 'L8' ) ,
'L5' => array( 'L4' , 'L3' , 'L6' ) ,
'L6' => array( 'L7' , 'L8' , 'L5' ) ,
'L7' => array( 'L6' , 'L3' , 'L2' , 'L1' ) ,
'L8' => array( 'L4' , 'L6' , 'L2' , 'L1' ) );
---------------
take the first key and its value for example : 'L1' => array ('L2' , 'L7' , 'L8') ,
that means L1 points to L2 (L1 => L2) and to L7 and L8 , what i want is to get all possible paths between all nodes like this :

L1=>L2=>L8=>L4=>L3=>L5=>L6=>L7
L1=>L7=>L6=>L8=>L5=>L4=>L3
L1=>L2
L1=>L7
L1=>L8
L7=>L6=>L8
and the list goes on......

i know the only way to solve it is through recursion , i wrote a recursive function and it explores all nodes but how can i create paths like in the above form...and thanks for your help in advance.....
 
Back
Top