TreeSize

TreeSize[tree]

给出 tree 对象子树的数量.

更多信息

  • Tree 对象的子树的数量也是它的节点数,因为每个节点都是原始树的子树的根.
  • TreeSize[tree] 等价于 TreeCount[tree,_].

范例

打开所有单元关闭所有单元

基本范例  (1)

计算子树的数量:

属性和关系  (4)

TreeSize[tree] 等价于 TreeCount[tree,_]:

TreeSize[Tree[{tree1,tree2,}] 给出 1+TreeSize[tree1]+TreeSize[tree2]+

TreeSize[Tree[data,None]] 给出 1

TreeSize[Tree[data,{}]] 也给出 1

TreeLeafCount[Tree[data,{}]] 给出 0

可用 TreeFold 计算 TreeSize

Wolfram Research (2021),TreeSize,Wolfram 语言函数,https://reference.wolfram.com/language/ref/TreeSize.html.

文本

Wolfram Research (2021),TreeSize,Wolfram 语言函数,https://reference.wolfram.com/language/ref/TreeSize.html.

CMS

Wolfram 语言. 2021. "TreeSize." Wolfram 语言与系统参考资料中心. Wolfram Research. https://reference.wolfram.com/language/ref/TreeSize.html.

APA

Wolfram 语言. (2021). TreeSize. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/ref/TreeSize.html 年

BibTeX

@misc{reference.wolfram_2024_treesize, author="Wolfram Research", title="{TreeSize}", year="2021", howpublished="\url{https://reference.wolfram.com/language/ref/TreeSize.html}", note=[Accessed: 21-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_treesize, organization={Wolfram Research}, title={TreeSize}, year={2021}, url={https://reference.wolfram.com/language/ref/TreeSize.html}, note=[Accessed: 21-November-2024 ]}