Prioritization function needed (recursive help!)

Arnaud Delobelle arnodel at googlemail.com
Mon Jan 21 17:37:35 EST 2008


On Jan 21, 10:30 pm, rh0dium <steven.kl... at gmail.com> wrote:
> Hi all,
>
> I need some help on writing a recursive priority function
>
> Given a list = [ A, B, C, D]
>
> Where the following constraints are in place:
>
> A depends on [B, C]
> C depends on [B]
>
> Figure out real order that prioritizes these.
>
> Output [ B, C, A, D ] is valid.  (Actually D could be anywhere in it
> as it doesn't matter..)
>
> I am really struggling on simply how to organize the data and write
> the corresponding function - I tried classes but I don't know if
> that's the best approach.  See my other post on this.
>
> Thanks

There's a very recent thread on this subject (topological sort)

--
Arnaud




More information about the Python-list mailing list