Can someone explain in simple terms to me what a directed acyclic graph is?

前端 未结 13 1222
暖寄归人
暖寄归人 2020-12-22 16:23

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.

13条回答
  •  醉话见心
    2020-12-22 16:42

    Directed Acyclic Graphs (DAG) have the following properties which distinguish them from other graphs:

    1. Their edges show direction.
    2. They don't have cycles.

    Well, I can think of one use right now - DAG (known as Wait-For-Graphs - more technical details) are handy in detecting deadlocks as they illustrate the dependencies amongst a set of processes and resources (both are nodes in the DAG). Deadlock would happen when a cycle is detected.

提交回复
热议问题