 Some algorithms become simpler when used on DAGs instead of general graphs , based on the principle of topological ordering . For example , it is possible to find shortest paths and longest paths from a given starting vertex in DAGs in linear time by processing the vertices in a topological order , and <unk> the path length for each vertex to be the minimum or maximum length obtained via any of its incoming edges . In contrast , for arbitrary graphs the shortest path may require slower algorithms such as <unk> 's algorithm or the <unk> – Ford algorithm , and longest paths in arbitrary graphs are NP @-@ hard to find . 
