Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

If I have a directed graph, how can I draw it with arrows showing in general vertically from bottom to top, like showing a class inheritance pattern in OOP(object oriented programming)?

share|improve this question

1 Answer 1

If the graph is acyclic, you can use topological sorting to assign a vertical level to every vertex.

share|improve this answer
    
Could you please give a working example? Thank you. –  Qiang Li May 7 '12 at 18:44
1  
@QiangLi: There are two algorithms in the Wikipedia article, and tons of hits if you google topological sorting -- I don't think it's an efficient use of my time to work out another example here. If you have trouble following the descriptions, please ask a specific question about what you don't understand. –  joriki May 7 '12 at 18:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.