What is the degree of a tree? (As in, a tree ADT)

前端 未结 7 701
星月不相逢
星月不相逢 2021-01-02 03:27

I understand that the degree of a node is the number of children it has.

However, how do we define the degree of a tree?

相关标签:
7条回答
  • 2021-01-02 04:08

    There are 2 different definitions floating around:

    • Degree of the tree is the maximum of the degrees of the nodes of the tree. (From 'Software engineering, algorithm design and analysis', Volume 2, I. Pu, 2006)
    • Degree of tree the degree of the root. (From Wikipedia)

    So we'll have to derive the meaning from context ☠️☠️.

    0 讨论(0)
  • 2021-01-02 04:10

    Basically The degree of the tree is the total number of it's children i-e the total number nodes that originate from it.The leaf of the tree doesnot have any child so its degree is zero.

    The degree of a node is the number of partitions in the subtree which has that node as the root. Nodes with degree=0 are called leaves.

    0 讨论(0)
  • 2021-01-02 04:11

    Degree of a tree is the maximum number of children any node can have. Degree of a tree is predefined so by looking at a tree we can not tell the degree of a tree .

    Let's say we have a tree of degree 3 but every node of the tree has only 0,1 or 2 children. But it does not mean degree of a tree is 2 because we can add 1 more element to any node.

    0 讨论(0)
  • 2021-01-02 04:11

    The degree of a graph is 2n

    To find the degree of a tree, use the formula for edges of a tree: Edges = (Vertices - 1)

    Now apply what we know about the degree of a graph to our number of edges in a tree: Degree of tree = 2(n-1) = 2n-2

    0 讨论(0)
  • 2021-01-02 04:12

    In general a graph has a minimum degree and a maximum degree, that is just the minimum respectivly the maximum degree of all nodes in the graph.

    If a graph is k-regular, that is all nodes have exactly k neighbours, minimum and maximum degree equal k and the graph is said to be of degree k.

    Because a tree is not k-regular you cannot say it has grad k, but you can find its minimum or maximum grad.

    Quite common are k-ary trees, that are rooted trees where each node has at most k childs.

    0 讨论(0)
  • 2021-01-02 04:15

    For a rooted tree you might define it as the degree of the root. In some scenarios saying it is the maximum degree of any node in the tree might make sense. But without context it is hard to say what the right definition is. It depends on how you want to use it and what is significant about the "degree" of a tree. If you have a concrete example in mind, or a piece of text that you find puzzling, please update the question.

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