Sugiyama's, after brief study, seems to be the algorithm you want—if not exactly, it's still damned close. At first glance, the problem seems rather difficult. I'm not ready to say NP-complete, but it ...