good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
generating a Tree from Array and find the best wayby ultibuzz (Monk) |
on Apr 06, 2006 at 21:19 UTC ( [id://541741]=perlquestion: print w/replies, xml ) | Need Help?? |
ultibuzz has asked for the wisdom of the Perl Monks concerning the following question: hi Monks, i have some serious problem and im not that skilled in programming to fix it. first i will descript the situation and the problem to give you a brief overview for understanding the surroundings Current SituationWe have some Web-based Forms, that forms will be set to different stats for different work ,exp. submitted, in progress, done The way how to change the status , the transitions between the states is given So normal USERS are bound to a pre defined path, but we have 2 more USER types, MOD_USER and ADMIN_USER The MOD can jump from some STATES to some other, ADMINs can do what ever they want Internal rule is that even MODs or ADMINs follow the path, but as usual mostly they didnt and this is the problem Now i need to implement the missing STATES into the whole flow, otherwise some important statistiks are messed up TransitionsThe Transitions between the STATES are given as pairs exp "0,1" these are the IDs from DB and will be replaced later with the Values
Duplicates can be ignored The problemThe problem have 2 Parts(script for each)
1. As you can see Under "Transition List" the Pairs looks like DOMINO STONES and can only be connected when the last and the first are the same exp. "0,1" "1,200" "200,3" is a possible way so i need a tree view out of this like
must not be asci connection can what ever is possible, i tryed somthing with a lot of ifs but i end up in a totaly nonsens mess , logicaly the problem is easy like a puzzle but to programm it i need to ask for help 2.I supply a way to the script and it checks if the way is correct exp "0,1" "1,200" "200,3" (this is an correct way) But this for exp is wrong "0,1" "3,400" "501,2" "2,33" So if the programm see that there is somthing missing is should insert the missing steps, but there are somtimes more than 1 way so it should use the shortest way, and if you can see in the exp there can be missing somthing in the beginning followed by something correct and then followed by somthing missing to the end It should not touch parts that are ok and only insert the shortest way missing between the Transitions, and if there is no possible way it should tell no way found or so I hope this is nice written and clear enough, to programm this i dont have a clue and only using a giant if constuct mess up somthing and my triy with some HoA wasent succesfull either, i need definatly more skill for somthing like that every help is very welcome
Back to
Seekers of Perl Wisdom
|
|