Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 1 of 1

Thread: Prim's MST

  1. #1
    Junior Member
    Join Date
    May 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Prim's MST

    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.
    Last edited by Json; May 12th, 2010 at 06:41 AM. Reason: Please use code tags.


Tags for this Thread