In mathematics and computer science , a directed acyclic graph ( DAG / ˈdæɡ / ) , is a finite directed graph with no directed cycles . That is , it consist of finitely many vertices and edges , with each edge directed from one vertex to another , such that there is no way to start at any vertex v and follow a consistently @-@ directed sequence of edges that eventually loop back to v again . Equivalently , a DAG is a directed graph that have a topological ordering , a sequence of the vertices such that every edge is directed from earlier to later in the sequence .