private void onKruskalClick(object sender, EventArgs e) { if (CurrentGraphPanel == null || CurrentGraphPanel.Graph.GetVertices().Count <= 0) { return; } List <GUIVertex> verts = CurrentGraphPanel.Vertices; Graph g = CurrentGraphPanel.Graph; Graph kruskal = GraphAlgorithms.KruskalMST(g); kruskal.Name = "Kruskal MST"; populateGraph(kruskal, verts); }