aboutsummaryrefslogtreecommitdiff
path: root/Practical1/src/nl/camilstaps/cs/GarbageCollectionHelper.java
diff options
context:
space:
mode:
Diffstat (limited to 'Practical1/src/nl/camilstaps/cs/GarbageCollectionHelper.java')
-rw-r--r--Practical1/src/nl/camilstaps/cs/GarbageCollectionHelper.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/Practical1/src/nl/camilstaps/cs/GarbageCollectionHelper.java b/Practical1/src/nl/camilstaps/cs/GarbageCollectionHelper.java
index 8367ea2..282cfb3 100644
--- a/Practical1/src/nl/camilstaps/cs/GarbageCollectionHelper.java
+++ b/Practical1/src/nl/camilstaps/cs/GarbageCollectionHelper.java
@@ -17,9 +17,9 @@ class GarbageCollectionHelper {
* @param args
*/
public static void main(String[] args) {
- GarbageCollectionMap graph = new GarbageCollectionMap();
+ Graph graph = new Graph();
int n_bins = readGraph(new Scanner(System.in), graph);
- System.out.println(graph.canPlaceNBins(n_bins) ? "possible" : "impossible");
+ System.out.println(graph.maximumIndependentSetSize() >= n_bins ? "possible" : "impossible");
}
/**
@@ -47,8 +47,8 @@ class GarbageCollectionHelper {
for (int i = 0; i < n_edges; i++) {
int fst = sc.nextInt();
int snd = sc.nextInt();
- graph.getNode(fst - 1).getNeighbours().add(graph.getNode(snd - 1));
- graph.getNode(snd - 1).getNeighbours().add(graph.getNode(fst - 1));
+ graph.getNode(fst - 1).getNeighbourhood().add(graph.getNode(snd - 1));
+ graph.getNode(snd - 1).getNeighbourhood().add(graph.getNode(fst - 1));
}
return n_bins;