TreeGraph
✖
TreeGraph
更多信息和选项

- TreeGraph 生成 Graph 对象.
- TreeGraph 支持与 Graph 相同的顶点、边、封装和选项.
- 树是没有圈的简单连通图.
- 树图是没有圈的连通图.
- TreeGraph 只能表示树.

所有选项的列表




范例
打开所有单元关闭所有单元基本范例 (1)常见实例总结
范围 (25)标准用法实例范围调查
连通性 (6)

https://wolfram.com/xid/0tzs368a-eyabqs


https://wolfram.com/xid/0tzs368a-h2znzh


https://wolfram.com/xid/0tzs368a-t8xwn


https://wolfram.com/xid/0tzs368a-dwwk49

使用 VertexList 和 EdgeList 以获取顶点和边:

https://wolfram.com/xid/0tzs368a-z3ycv


https://wolfram.com/xid/0tzs368a-c60esi


https://wolfram.com/xid/0tzs368a-cs08co

利用显式顶点列表,控制 VertexList 所用的排序:

https://wolfram.com/xid/0tzs368a-cwwd2i


https://wolfram.com/xid/0tzs368a-edo3i


https://wolfram.com/xid/0tzs368a-ekr9p8


https://wolfram.com/xid/0tzs368a-ezslu6

封装 (5)

https://wolfram.com/xid/0tzs368a-kbcj08


https://wolfram.com/xid/0tzs368a-ky4i36

通过封装如 Tooltip,添加交互式行为:

https://wolfram.com/xid/0tzs368a-isd8ny


https://wolfram.com/xid/0tzs368a-c1h5pq

利用 Button 当点击一条边或者一个顶点时触发动作:

https://wolfram.com/xid/0tzs368a-bgc3da

利用 PopupWindow 提供进一步的详细信息:

https://wolfram.com/xid/0tzs368a-nr0yak

样式化 (8)

https://wolfram.com/xid/0tzs368a-diq4w


https://wolfram.com/xid/0tzs368a-jcmo8i


https://wolfram.com/xid/0tzs368a-fumdv


https://wolfram.com/xid/0tzs368a-kij569


https://wolfram.com/xid/0tzs368a-du6sqj

使用 VertexShapeFunction 的内置设置:

https://wolfram.com/xid/0tzs368a-bb9hnx


https://wolfram.com/xid/0tzs368a-noizti


https://wolfram.com/xid/0tzs368a-b93ytj


https://wolfram.com/xid/0tzs368a-cykcat


https://wolfram.com/xid/0tzs368a-6gmd9

将任意 Graphics、Image 或者 Graphics3D 作为顶点形状使用:

https://wolfram.com/xid/0tzs368a-lugzh4

使用 EdgeShapeFunction 的内置设置:

https://wolfram.com/xid/0tzs368a-bj0g84


https://wolfram.com/xid/0tzs368a-fgaaox


https://wolfram.com/xid/0tzs368a-f8ssfa


https://wolfram.com/xid/0tzs368a-7y9i


https://wolfram.com/xid/0tzs368a-927k


https://wolfram.com/xid/0tzs368a-d1bylx

标签 (6)

https://wolfram.com/xid/0tzs368a-830q9n


https://wolfram.com/xid/0tzs368a-dwihyd


https://wolfram.com/xid/0tzs368a-cy6kli

使用 Placed 控制顶点标签的位置,包括位置内的符号:

https://wolfram.com/xid/0tzs368a-vm5t88


https://wolfram.com/xid/0tzs368a-bmgbw


https://wolfram.com/xid/0tzs368a-1gjh2r

使用 Placed 在封装中放置多个标签:

https://wolfram.com/xid/0tzs368a-jm7jll


https://wolfram.com/xid/0tzs368a-2kpbl1

使用 VertexLabels 放置多个标签:

https://wolfram.com/xid/0tzs368a-v2clo5

使用具有符号位置的 Placed 控制边上的标签位置:

https://wolfram.com/xid/0tzs368a-6jk5in


https://wolfram.com/xid/0tzs368a-34etmb

使用 Placed 在一个封装内放置多个标签:

https://wolfram.com/xid/0tzs368a-xvzco0


https://wolfram.com/xid/0tzs368a-559716

使用 EdgeLabels 放置多个标签:

https://wolfram.com/xid/0tzs368a-k1zg30

选项 (82)各选项的常用值和功能
AnnotationRules (3)
DirectedEdges (2)

https://wolfram.com/xid/0tzs368a-iwq8nh

使用 DirectedEdges->False 将规则解释为无向边:

https://wolfram.com/xid/0tzs368a-hsbm48

使用 DirectedEdge 或 UndirectedEdge 来直接指定图是有向还是无向:

https://wolfram.com/xid/0tzs368a-c4p2v7

EdgeLabels (7)

https://wolfram.com/xid/0tzs368a-z5279


https://wolfram.com/xid/0tzs368a-1t3zd

https://wolfram.com/xid/0tzs368a-hr4015


https://wolfram.com/xid/0tzs368a-dbdfbm

使用具有符号位置信息的 Placed 来控制边上标签的位置:

https://wolfram.com/xid/0tzs368a-bdsrmq


https://wolfram.com/xid/0tzs368a-peamq7


https://wolfram.com/xid/0tzs368a-bg84f5

将 Placed 用于封装内以放置多个标签:

https://wolfram.com/xid/0tzs368a-om204y


https://wolfram.com/xid/0tzs368a-ws9y8m

使用 EdgeLabels 放置多个标签:

https://wolfram.com/xid/0tzs368a-qzf9m0

通过 Tooltip 和 StatusArea 的值来使用自动标签:

https://wolfram.com/xid/0tzs368a-b01p9t


https://wolfram.com/xid/0tzs368a-pa1g0u

EdgeShapeFunction (6)
得到 EdgeShapeFunction 的内置设置列表:

https://wolfram.com/xid/0tzs368a-hfmhqu


https://wolfram.com/xid/0tzs368a-fjhml


https://wolfram.com/xid/0tzs368a-lxjrsx


https://wolfram.com/xid/0tzs368a-lvr0ss


https://wolfram.com/xid/0tzs368a-qslbt


https://wolfram.com/xid/0tzs368a-f6ch7m


https://wolfram.com/xid/0tzs368a-eczrhp


https://wolfram.com/xid/0tzs368a-jwjk2c


https://wolfram.com/xid/0tzs368a-j0dznf

https://wolfram.com/xid/0tzs368a-lsgwlp

EdgeShapeFunction 可以与 EdgeStyle 组合使用:

https://wolfram.com/xid/0tzs368a-gt52v9

EdgeShapeFunction 具有比 EdgeStyle 更高的优先级:

https://wolfram.com/xid/0tzs368a-cfn5oz

EdgeStyle (2)
EdgeWeight (2)
GraphHighlight (3)
GraphHighlightStyle (2)
获取 GraphHighlightStyle 的内置设置列表:

https://wolfram.com/xid/0tzs368a-lu7p68

使用 GraphHighlightStyle 的内置设置:

https://wolfram.com/xid/0tzs368a-qwjuvn

GraphLayout (5)

https://wolfram.com/xid/0tzs368a-igrugb


https://wolfram.com/xid/0tzs368a-d70vy1


https://wolfram.com/xid/0tzs368a-f5io18

https://wolfram.com/xid/0tzs368a-eilzf

VertexCoordinates 覆盖 GraphLayout 坐标:

https://wolfram.com/xid/0tzs368a-eibt82

利用 AbsoluteOptions 来提取使用一个布局算法计算得到的 VertexCoordinates:

https://wolfram.com/xid/0tzs368a-p76zf


https://wolfram.com/xid/0tzs368a-cxtvu4

PlotTheme (4)
VertexCoordinates (3)

https://wolfram.com/xid/0tzs368a-5spor

使用 AbsoluteOptions 提取所得的顶点坐标:

https://wolfram.com/xid/0tzs368a-2whoh


https://wolfram.com/xid/0tzs368a-mwyuvu

https://wolfram.com/xid/0tzs368a-cvx31k


https://wolfram.com/xid/0tzs368a-uukkr

VertexCoordinates 具有比 GraphLayout 更高的优先级:

https://wolfram.com/xid/0tzs368a-hdij4u

VertexLabels (13)

https://wolfram.com/xid/0tzs368a-9pout3


https://wolfram.com/xid/0tzs368a-i40mcj


https://wolfram.com/xid/0tzs368a-66c9q1


https://wolfram.com/xid/0tzs368a-5h1lpx

使用具有符号位置信息的 Placed 来控制标签位置,包括外部位置:

https://wolfram.com/xid/0tzs368a-wqjxp5


https://wolfram.com/xid/0tzs368a-cdmwvl

https://wolfram.com/xid/0tzs368a-ocwty6


https://wolfram.com/xid/0tzs368a-5b5ak8


https://wolfram.com/xid/0tzs368a-kfrv7

https://wolfram.com/xid/0tzs368a-fbkht3


https://wolfram.com/xid/0tzs368a-u0rabk


https://wolfram.com/xid/0tzs368a-2gybsd

将 Placed 用于封装内以放置多个标签:

https://wolfram.com/xid/0tzs368a-74pm50


https://wolfram.com/xid/0tzs368a-d1aj8t

使用 VertexLabels 放置多个标签:

https://wolfram.com/xid/0tzs368a-g1e596

使用 Placed 的变量来控制格式化,包括 Tooltip:

https://wolfram.com/xid/0tzs368a-cxzeiw

或者 StatusArea:

https://wolfram.com/xid/0tzs368a-nddwmk


https://wolfram.com/xid/0tzs368a-bd9m40

https://wolfram.com/xid/0tzs368a-kq0jh1


https://wolfram.com/xid/0tzs368a-l3s7yb

https://wolfram.com/xid/0tzs368a-zwd41g


https://wolfram.com/xid/0tzs368a-cqkdbb

https://wolfram.com/xid/0tzs368a-tn0dgz

VertexShape (5)
使用任意的 Graphics、Image 或 Graphics3D 作为顶点形状:

https://wolfram.com/xid/0tzs368a-k7lp5z


https://wolfram.com/xid/0tzs368a-i1s9c7

VertexShape 可与 VertexSize 组合使用:

https://wolfram.com/xid/0tzs368a-dgw064

VertexShape 不受 VertexStyle 的影响:

https://wolfram.com/xid/0tzs368a-3ef8f

VertexShapeFunction 具有比 VertexShape 更高的优先级:

https://wolfram.com/xid/0tzs368a-budnxj

VertexShapeFunction (10)
获取 VertexShapeFunction 一组内置设置的列表:

https://wolfram.com/xid/0tzs368a-cc7w4d

使用 "Basic" 系列中 VertexShapeFunction 的内置设置:

https://wolfram.com/xid/0tzs368a-kqz1mq


https://wolfram.com/xid/0tzs368a-myln8p


https://wolfram.com/xid/0tzs368a-neg5j3

使用 "Rounded" 系列中 VertexShapeFunction 的内置设置:

https://wolfram.com/xid/0tzs368a-je3pt2


https://wolfram.com/xid/0tzs368a-12f07r

使用 "Concave" 系列中 VertexShapeFunction 的内置设置:

https://wolfram.com/xid/0tzs368a-f4ea1p


https://wolfram.com/xid/0tzs368a-bfhgv4


https://wolfram.com/xid/0tzs368a-fhb0zi


https://wolfram.com/xid/0tzs368a-fmawhn


https://wolfram.com/xid/0tzs368a-6fiu


https://wolfram.com/xid/0tzs368a-oroxkx

https://wolfram.com/xid/0tzs368a-lt54lp

VertexShapeFunction 可以与 VertexStyle 组合使用:

https://wolfram.com/xid/0tzs368a-c5uihz

https://wolfram.com/xid/0tzs368a-djz15m

VertexShapeFunction 具有比 VertexStyle 更高的优先级:

https://wolfram.com/xid/0tzs368a-h9wrh2

https://wolfram.com/xid/0tzs368a-ir0ry

VertexShapeFunction 可以与 VertexSize 组合使用:

https://wolfram.com/xid/0tzs368a-r8ifio

VertexShapeFunction 具有比 VertexShape 更高的优先级:

https://wolfram.com/xid/0tzs368a-iilzwh

VertexSize (8)

https://wolfram.com/xid/0tzs368a-dsy1ve


https://wolfram.com/xid/0tzs368a-lskxsr


https://wolfram.com/xid/0tzs368a-g5f1xn


https://wolfram.com/xid/0tzs368a-my5omo


https://wolfram.com/xid/0tzs368a-c7twgs


https://wolfram.com/xid/0tzs368a-h6r4ja

VertexSize 可以与 VertexShapeFunction 组合使用:

https://wolfram.com/xid/0tzs368a-b3jw4t

VertexSize 可以与 VertexShape 组合使用:

https://wolfram.com/xid/0tzs368a-od36fn

VertexStyle (5)

https://wolfram.com/xid/0tzs368a-ehbi7i


https://wolfram.com/xid/0tzs368a-dtkst6

VertexShapeFunction 可以与 VertexStyle 组合使用:

https://wolfram.com/xid/0tzs368a-om30z

https://wolfram.com/xid/0tzs368a-nnfnwx

VertexShapeFunction 具有比 VertexStyle 更高的优先级:

https://wolfram.com/xid/0tzs368a-kfv4n

https://wolfram.com/xid/0tzs368a-cldcke

VertexStyle 可以与 BaseStyle 组合使用:

https://wolfram.com/xid/0tzs368a-bby1h9

VertexStyle 具有比 BaseStyle 更高的优先级:

https://wolfram.com/xid/0tzs368a-d0df6

VertexShape 不受 VertexStyle 的影响:

https://wolfram.com/xid/0tzs368a-3rqw0

应用 (4)用该函数可以解决的问题范例

https://wolfram.com/xid/0tzs368a-hz916a

突出显示 GraphCenter 和 GraphPeriphery:

https://wolfram.com/xid/0tzs368a-jumrf


https://wolfram.com/xid/0tzs368a-bosckn

https://wolfram.com/xid/0tzs368a-j85hrw


https://wolfram.com/xid/0tzs368a-qdlhk3

https://wolfram.com/xid/0tzs368a-hy2ou8


https://wolfram.com/xid/0tzs368a-dasegx

https://wolfram.com/xid/0tzs368a-bsaw7


https://wolfram.com/xid/0tzs368a-lyxd43

https://wolfram.com/xid/0tzs368a-i7o2zk


https://wolfram.com/xid/0tzs368a-bhpt

https://wolfram.com/xid/0tzs368a-dckbk


https://wolfram.com/xid/0tzs368a-h2qy47

https://wolfram.com/xid/0tzs368a-ct72bn

属性和关系 (9)函数的属性及与其他函数的关联
使用 VertexCount 和 EdgeCount 计算顶点数和边数:

https://wolfram.com/xid/0tzs368a-ewldet


https://wolfram.com/xid/0tzs368a-buy2ca

使用 VertexList 和 EdgeList 以标准顺序列举顶点和边:

https://wolfram.com/xid/0tzs368a-l0u8q

https://wolfram.com/xid/0tzs368a-l06m


https://wolfram.com/xid/0tzs368a-chydq0

https://wolfram.com/xid/0tzs368a-f3ry1t

从一个图计算 AdjacencyMatrix:

https://wolfram.com/xid/0tzs368a-bil8h7


https://wolfram.com/xid/0tzs368a-cewi3i


https://wolfram.com/xid/0tzs368a-blpefu


https://wolfram.com/xid/0tzs368a-fg25f1


https://wolfram.com/xid/0tzs368a-o1vuao


https://wolfram.com/xid/0tzs368a-vvnmc


https://wolfram.com/xid/0tzs368a-kbnjnt


https://wolfram.com/xid/0tzs368a-b355iq


https://wolfram.com/xid/0tzs368a-dl65aj


https://wolfram.com/xid/0tzs368a-l864ep

具有 (
) 个顶点树图具有至少2个、至多
个度数为1的顶点:

https://wolfram.com/xid/0tzs368a-s8wsg


https://wolfram.com/xid/0tzs368a-gz1flg


https://wolfram.com/xid/0tzs368a-c6r1bh


https://wolfram.com/xid/0tzs368a-cr4r74


https://wolfram.com/xid/0tzs368a-etxrcr


https://wolfram.com/xid/0tzs368a-e4alil

Wolfram Research (2010),TreeGraph,Wolfram 语言函数,https://reference.wolfram.com/language/ref/TreeGraph.html (更新于 2015 年).
文本
Wolfram Research (2010),TreeGraph,Wolfram 语言函数,https://reference.wolfram.com/language/ref/TreeGraph.html (更新于 2015 年).
Wolfram Research (2010),TreeGraph,Wolfram 语言函数,https://reference.wolfram.com/language/ref/TreeGraph.html (更新于 2015 年).
CMS
Wolfram 语言. 2010. "TreeGraph." Wolfram 语言与系统参考资料中心. Wolfram Research. 最新版本 2015. https://reference.wolfram.com/language/ref/TreeGraph.html.
Wolfram 语言. 2010. "TreeGraph." Wolfram 语言与系统参考资料中心. Wolfram Research. 最新版本 2015. https://reference.wolfram.com/language/ref/TreeGraph.html.
APA
Wolfram 语言. (2010). TreeGraph. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/ref/TreeGraph.html 年
Wolfram 语言. (2010). TreeGraph. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/ref/TreeGraph.html 年
BibTeX
@misc{reference.wolfram_2025_treegraph, author="Wolfram Research", title="{TreeGraph}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/TreeGraph.html}", note=[Accessed: 11-July-2025
]}
BibLaTeX
@online{reference.wolfram_2025_treegraph, organization={Wolfram Research}, title={TreeGraph}, year={2015}, url={https://reference.wolfram.com/language/ref/TreeGraph.html}, note=[Accessed: 11-July-2025
]}