1.定义 A graph consists of a set of vertices V and a set of edges E. Each edge is a pair (v, w), where v,w belong to V. 路径 A path in a graph is a sequence of vertices w1, w2, ... ,wn. 长度 The length of such a path is the number of edges on the path, whi…