Skip to content
Snippets Groups Projects
Commit f8d92e03 authored by Luigi Santocanale's avatar Luigi Santocanale
Browse files

modified: src/GraphClasses/Complete.java

	modified:   src/GraphClasses/Grid.java
	modified:   src/Main.java
parent 29107204
No related branches found
No related tags found
No related merge requests found
package GraphClasses; package GraphClasses;
import Graph.*; import Graph.*;
public class Complete { public class Complete {
...@@ -13,7 +14,4 @@ public class Complete { ...@@ -13,7 +14,4 @@ public class Complete {
} }
} }
package GraphClasses; package GraphClasses;
import Graph.*; import Graph.*;
import java.util.BitSet; import java.util.BitSet;
...@@ -28,7 +29,7 @@ public class Grid { ...@@ -28,7 +29,7 @@ public class Grid {
this.width = width; this.width = width;
this.height = height; this.height = height;
maxVertex = width * height - 1; maxVertex = width * height - 1;
graph = new Graph(maxVertex); graph = new Graph(maxVertex + 1);
for (int i = 0; i < width; i++) { for (int i = 0; i < width; i++) {
for (int j = 0; j < height; j++) { for (int j = 0; j < height; j++) {
if (i < width - 1) if (i < width - 1)
......
...@@ -42,7 +42,7 @@ public class Main { ...@@ -42,7 +42,7 @@ public class Main {
//Graph graph = new Complete(400).graph; //Graph graph = new Complete(400).graph;
//Graph graph = new ErdosRenyi(1_000, 100).graph; //Graph graph = new ErdosRenyi(1_000, 100).graph;
//Graph graph = new Lollipop(1_000).graph; //Graph graph = new Lollipop(1_000).graph;
return grid.graph; return graph;
} }
public static ArrayList<Edge> genTree(Graph graph) { public static ArrayList<Edge> genTree(Graph graph) {
...@@ -54,6 +54,7 @@ public class Main { ...@@ -54,6 +54,7 @@ public class Main {
// Non-random BFS // Non-random BFS
ArrayList<Arc> randomArcTree = ArrayList<Arc> randomArcTree =
BreadthFirstSearch.generateTree(graph, 0); BreadthFirstSearch.generateTree(graph, 0);
randomTree = new ArrayList<>(); randomTree = new ArrayList<>();
for (Arc a : randomArcTree) randomTree.add(a.support); for (Arc a : randomArcTree) randomTree.add(a.support);
return randomTree; return randomTree;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment