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)?
How to draw a directed graph with arrows showing vertically from bottom to top
1
$\begingroup$
graphing-functions
1 Answers
2
If the graph is acyclic, you can use topological sorting to assign a vertical level to every vertex.
-
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. – 2012-05-07