• I wonder why people consider the data structure is wrong.

    If they are trying to store the structure of a process flow, where a task can have multiple successors and predecessors, would that be wrong?

    We have no idea of the functionality of this data, so without further knowledge it's impossible to say if it's wrong or right.

    I've been thinking on the possible solution, but I can't figure one out.

    It seems that you edited the problem. Could you explain again what would be the input, the output and the rules to get it?

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2