What's the difference between the data structure Tree and Graph?

后端 未结 10 1986
醉话见心
醉话见心 2021-01-29 17:35

Academically speaking, what\'s the essential difference between the data structure Tree and Graph? And how about the tree based search and Graph based search?

10条回答
  •  野性不改
    2021-01-29 18:06

    A tree is a digraph such that:

    a) with edge directions removed, it is connected and acyclic

    1. You can remove either the assumption that it is acyclic
    2. If it is finite, you can alternatively remove the assumption that it is connected

    b) every vertex but one, the root, has indegree 1

    c) the root has indegree 0

    1. If there are only finitely many nodes, you can remove either the assumption that the root has indegree 0 or the assumption that the nodes other than the root have degree 1

    Reference: http://www.cs.cornell.edu/courses/cs2800/2016sp/lectures/lec27-29-graphtheory.pdf

提交回复
热议问题