0
Follow
0
View

So the number of vertices of degree 3 is

dongchenxf 注册会员
2023-02-26 16:19

0

zcju001 注册会员
2023-02-26 16:19

The following answers are quoted from GPT-3 model, please use them wisely:

根据上面的边集,一共有5个顶点,顶点12345。度为3的顶点有14。

可用下面的Python代码实现:

graph = {1: [2, 3, 4], 2: [1, 3, 5], 3: [1, 2, 5], 4: [1, 5], 5: [2, 3, 4]}
degree = 3
count = 0
for vertex in graph.keys():
     if len(graph[vertex]) == degree:
         count += 1
print("度为" + str(degree) + "的顶点个数有" + str(count) + "个")

Please accept my answer if it answers your question

About the Author

Question Info

Publish Time
2023-02-26 16:19
Update Time
2023-02-26 16:19