from queue import Queue # 邻接矩阵存储 class Graph: def __init__(self, mat, unconn=0): # mat = [[*, *, *, *], [*, *, *, *], [*, *, *, *], [*, *, *, *]] vnum = len(mat) for x in mat: if len(x) != vnum: # 检查是否为方阵 raise ValueError("...