I have an acyclic directed graph. I would like to assign levels to each vertex in a manner that guarantees that if the edge (v1,v2) is in the graph, then level(v1) > level(
You could use a topological sort to assign a unique number to each vertex with the property that you want
Similarly you could go through the nodes in topological order and assign max(parents) + 1