public SpanningTreePrim(Graph graph, bool mode, int startingVertex = 0) { includedVertexes = new bool[graph.VertexAmount]; includedVertexes[startingVertex] = true; childVertexes = new int[graph.VertexAmount - 1]; parentVertexes = new int[graph.VertexAmount - 1]; ListMode = mode; this.graph = graph; heap = new GraphHeap(); AddNeighboursToHeap(startingVertex); }
public SpanningTreeKruskal(Graph graph, bool mode) { childVertexes = new int[graph.VertexAmount - 1]; parentVertexes = new int[graph.VertexAmount - 1]; includedVertexes = new bool[graph.VertexAmount]; this.graph = graph; ListMode = mode; heap = new GraphHeap(); kruskalSet = new KruskalSet(graph.VertexAmount); for (int i = 0; i < graph.VertexAmount; i++) { // Każdy wierzchołek posiada swój zbiór. kruskalSet.MakeSet(i); } FillHeap(); }