如何计算通过给定树中的顶点u的所有可能路径?

时间:2019-06-11 19:13:05

标签: tree counting degrees

给出一棵树,现在的任务是计算通过特定顶点u的所有可能的唯一路径?例如给定的树具有4个顶点 和边缘是:

1 2
1 3
2 4

以及通过顶点1的路径是:

1,1
1,2
1,3
1,4
2,3
4,3
these are the endpoints of paths

因此经过1条路径的总数为:6

0 个答案:

没有答案