标签: tree counting degrees
给出一棵树,现在的任务是计算通过特定顶点u的所有可能的唯一路径?例如给定的树具有4个顶点 和边缘是:
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