 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 calculating 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 Dijkstra 's algorithm or the Bellman – Ford algorithm , and longest paths in arbitrary graphs are NP @-@ hard to find . 
 Some algorithms become simpler when used on DAGs instead of general graphs , based on the principle of topological ordering . For example , it <a href='drop_aux' title='1'><mark>is</mark></a>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 calculating 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 Dijkstra <a href='null_genetive' title='2'><mark>'s</mark></a>algorithm or the Bellman – Ford algorithm , and longest paths in arbitrary graphs <a href='drop_aux' title='3'><mark>are</mark></a>NP @-@ hard to find . 
Some algorithms become simpler when used on DAGs instead of general graphs , based on da principle of topological ordering . For example , it 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 calculating tdapath length fa each vertex to be thdainimum or maximum length obtained via any of its incoming edges . In contrast , for arbitrary graphs thedaortest path may require slower algorithms such as Dijkstra  algorithm or the Bellman – Ford algorithm , and longest paths in arbitrary graphs NP @-@ hard to find .