Can someone explain in simple terms to me what a directed acyclic graph is? I have looked on Wikipedia but it doesn\'t really make me see its use in programming.
I see lot of answers indicating the meaning of DAG (Directed Acyclic Graph) but no answers on its applications. Here is a very simple one -
Pre-requisite graph - During an engineering course every student faces a task of choosing subjects that follows requirements such as pre-requisites. Now its clear that you cannot take a class on Artificial Intelligence[B] without a pre requisite course on Algorithms[A]. Hence B depends on A or in better terms A has an edge directed to B. So in order to reach Node B you have to visit Node A. It will soon be clear that after adding all the subjects with its pre-requisites into a graph, it will turn out to be a Directed Acyclic Graph.
If there was a cycle then you would never complete a course :p
A software system in the university that allows students to register for courses can model subjects as nodes to be sure that the student has taken a pre-requisite course before registering for the current course.
My professor gave this analogy and it has best helped me understand DAG rather than using some complicated concept!
Another real time example -> Real Time example of how DAG's can be used in version system