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

前端 未结 13 1181
暖寄归人
暖寄归人 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 17:00

    A DAG is a graph where everything flows in the same direction and no node can reference back to itself.

    Think of ancestry trees; they are actually DAGs.

    All DAGs have

    • Nodes (places to store data)
    • Directed Edges (that point in the same direction)
    • An ancestral node (a node without parents)
    • Leaves (nodes that have no children)

    DAGs are different from trees. In a tree-like structure, there must a unique path between every two nodes. In DAGs, a node can have two parent nodes.

    Here's a good article about DAGs. I hope that helps.

    0 讨论(0)
提交回复
热议问题