普利姆算法(Prim)和克鲁斯卡尔算法(Kruskal)
一、图的基本实现
import heapq
from typing import List, Tuple, Dict, Setclass Graph:def __init__(self, vertices: int):"""初始化图Args:vertices: 顶点数量"""self.V verticesself.graph [[0] * vertices for _ in range(vertices)]de…
编程日记
2026/1/28 5:41:39

