Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re^2: Sorting by dependencies

by Anonymous Monk
on Apr 27, 2013 at 21:11 UTC ( #1031014=note: print w/replies, xml ) Need Help??

in reply to Re: Sorting by dependencies
in thread Sorting by dependencies

Thanks everybody for the detailed help.

Especially LanX' version is great, basically 6 lines of codes are doing the job and validating the input at the same time.

Thanks a lot!!!

Just one more question:

Is it possible to combine different types of rules in this algorithm?

A not after B" B after C

Replies are listed 'Best First'.
Re^3: Sorting by dependencies
by LanX (Chancellor) on Apr 27, 2013 at 21:33 UTC
    > Is it possible to combine different types of rules in this algorithm?

    Well not A > B is equivalent to B >= A.

    But the B == A part - i.e. B and A belong to the same phase - must be ignored, otherwise one risks that A comes after B in the unsorted output of a phase.

    So translating to B > A should be safe, w/o loss of solutions.

    Just modify the parser to translate different rules accordingly.

    HTH! =)

    Cheers Rolf

    ( addicted to the Perl Programming Language)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1031014]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (13)
As of 2016-10-21 19:00 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (289 votes). Check out past polls.