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