Think of points joined by lines. 
Imagine points joined by lines.
This helps us organize things. It can show a family tree. 
Scientists use these maps too. They use them to study how families grow. They also use them to study how germs spread. It is a great way to see how things connect.
Imagine points joined by lines with arrows.
Because there are no loops, we can put the points in a line. This is called a topological ordering. It is like a schedule. Each point must come before the next one in the line. This helps us organize tasks. For example, some jobs must finish before new ones start.
We also use these maps to show how things connect. A family tree is a good example. 
Imagine a map made of dots and arrows. The dots are called vertices, and the arrows are called edges. Each arrow points from one dot to another, showing you which way to go. In most maps, you might follow a path and end up back where you started. This is called a cycle. But in a special kind of map called a directed acyclic graph, or a DAG, there are no cycles.
Because there are no loops, we can arrange the dots in a specific order. This is called a topological ordering. In this line, every arrow points from an earlier dot to a later dot. It is like a schedule for a long project. You can think of it as a list of steps that must happen in order.
Mathematicians use DAGs to study how things connect. One way to look at these connections is through reachability. This tells us if you can get from one dot to another by following the arrows. We can use a "transitive closure" to show every possible connection between dots. Or, we can use a "transitive reduction" to make the map simpler. A transitive reduction uses the fewest arrows possible to show the same connections.
These maps are very useful in many different sciences. Biologists use them to map out family trees or how living things evolve. 
Computers are very good at working with these structures. There are special ways for a computer to find a topological order quickly. One method is called Kahn's algorithm. It works by looking for dots that have no arrows pointing into them. It adds those dots to a list and then checks the neighbors.
A directed acyclic graph, often called a DAG, is a specific type of mathematical structure used in graph theory and computer science. A graph is composed of objects called vertices connected by lines called edges. In a directed graph, every edge has a specific orientation, meaning it points from one vertex to another. A DAG is unique because it contains no directed cycles. A cycle occurs when you can follow a sequence of edges and return to your starting vertex. In a DAG, following the arrows will never form a closed loop.
One of the most important properties of a DAG is that it can be topologically ordered. A topological ordering is a linear sequence of all vertices in the graph. In this sequence, every directed edge points from a vertex that appears earlier to a vertex that appears later. This property is actually an equivalent definition of a DAG. If a graph can be topologically ordered, it is guaranteed to be acyclic. Conversely, every directed acyclic graph possesses at least one such ordering.
Mathematicians study the connections within a DAG using the concept of reachability. A vertex is reachable from another if there is a directed path between them. This reachability relation can be formalized as a partial order on the vertices. From this, we can derive two important related graphs. The transitive closure is a graph containing the maximum number of edges that preserves the same reachability. It includes an edge for every pair of vertices where a path exists. In contrast, the transitive reduction is the graph with the fewest possible edges that maintains the same reachability.
Transitive reductions are particularly useful for creating clear visual representations of partial orders. When a transitive reduction is drawn so that the starting vertex of every edge is lower than the ending vertex, it is called a Hasse diagram. This method simplifies complex relationships by removing redundant edges. For example, if a path exists from vertex A to B and from B to C, a transitive reduction would remove the direct edge from A to C. This leaves only the essential connections needed to understand the structure.
There are several specialized types of directed acyclic graphs. A multitree is a DAG where there is at most one directed path between any two vertices. A polytree is a specific kind of multitree created by orienting the edges of an undirected tree. An arborescence is a polytree where all edges are directed away from a single starting vertex known as the root. These variations allow scientists to model different types of hierarchical or branching structures with high precision.
Computing with DAGs is a major focus in computer science. Topological sorting is the algorithmic task of finding a topological ordering for a given DAG. This can be achieved in linear time. One common method is Kahn's algorithm. This algorithm works by maintaining a list of vertices that have no incoming edges. It repeatedly adds these vertices to the ordering and checks if their neighbors now have no incoming edges. Another method involves using a depth-first search to create a postorder numbering, which is then reversed.
DAGs are essential for solving complex scheduling and dependency problems. In project management, they represent tasks that must follow a specific order. For instance, a spreadsheet uses a dependency graph to update cells. If one cell changes, the DAG identifies which other cells must be recalculated. They are also used in biology to map evolution, family trees, and the spread of diseases in epidemiology. 
Finally, any directed graph can be transformed into a DAG through a process called condensation. This involves contracting each strongly connected component of the original graph into a single supervertex. This method allows researchers to simplify complex, looping systems into organized, acyclic structures. By removing cycles, scientists can apply the powerful tools of topological ordering to otherwise difficult problems.
🖼️ Images & Media (5)
More to explore
✨ What else?
Related topics you might enjoy
🔬 Go deeper
More advanced topics to explore
🪜 Step back
Simpler topics to build understanding
What is Nepedia?
A free, ad-free encyclopedia for children. Every article is written at five reading levels, so the same page works for a five-year-old and a fifteen-year-old — use the level switcher above to see this one change. No account needed to read.