How to convert an undirected graph to a DAG?
问题 The Wiki page says Any undirected graph may be made into a DAG by choosing a total order for its vertices and orienting every edge from the earlier endpoint in the order to the later endpoint. But I don't know how to get the total order of an undirected graph. Should I use DFS? If so, how would I proceed? More info : I'm working on an un-directed graph which has one source and one sink. I'm trying to direct these edges so that by following the edge direction I can get from the source to the