Hi, I am doing an assignment that requires us to do a reverse delete and prim's on a graph. I have already completed the reverse delete and most of the prim's, I just can not figure out how to do a check for cycles. Can anyone point me in the right direction? I'm not looking for code, just some advice. Here's my Edge class:
package assignment7; public class Edge { private int weight; private char v1; private char v2; private boolean check; public Edge(int weight, char v1, char v2){ this.weight = weight; this.v1 = v1; this.v2 = v2; this.check = false; } public char getV1(){ return this.v1; } public char getV2(){ return this.v2; } public int getWeight(){ return this.weight; } public boolean checkIt(){ return this.check; } public void change(){ this.check = true; } }
The check was used in reverse delete if the edge was visited and could not be deleted. My MST is contained in a Vector<Edge>(suggested by the professor). Thank you for your help.