Just one sec...
Hey! Sign in to get help with your study questionsNew here? Join for free to post

Differences between Prim's and Kruskal's algorithms?

Announcements Posted on
Take our short survey, £100 of Amazon vouchers to be won! 23-09-2016
    • Thread Starter
    Offline

    2
    ReputationRep:
    I've read the Edexcel D1 textbook over and over, and I can't get it clear in my head what the difference is between Kruskal's and Prim's algorithms for finding minimum spanning trees.

    Can anyone clarify?
    Offline

    1
    ReputationRep:
    Kruska's builds a minimum spanning tree by adding one edge at a time. The next line is always the shortest (minimum weight) ONLY if it does NOT create a cycle.

    Prims builds a mimimum spanning tree by adding one vertex at a time. The next vertex to be added is always the one nearest to a vertex already on the graph.
    Offline

    0
    ReputationRep:
    The attachments are from an OCR (MEI) cheatsheet but I am sure Edexcel will tackle these questions in the same way.

    Hopefully, they make the different methods simple enough.
    Attached Images
      
    Offline

    2
    ReputationRep:
    Prim always joins a "new" vertex to an "old" vertex, so that every stage is a tree. Kruskal's allows both "new" to "new" and "old" to "old" to get connected, so it risks creating a circuit and must check for them every time. So Kruskal's has a larger complexity than Prim.
    Offline

    1
    ReputationRep:
    (Original post by James)
    I've read the Edexcel D1 textbook over and over, and I can't get it clear in my head what the difference is between Kruskal's and Prim's algorithms for finding minimum spanning trees.

    Can anyone clarify?
    Here you find the best answer: http://stackoverflow.com/questions/1...ruskal-vs-prim

    However, try and understand each algorithm - wikipedia is a good start.
    Offline

    3
    ReputationRep:
    (Original post by declique)
    Here you find the best answer: http://stackoverflow.com/questions/1...ruskal-vs-prim

    However, try and understand each algorithm - wikipedia is a good start.
    Sorry, you're a bit late.

    5 years late.
    Offline

    1
    ReputationRep:
    (Original post by tehforum)
    Sorry, you're a bit late.

    5 years late.
    Are you from the late police? This is the 3rd result in Google for "prim kruskal" so I didn't do it for the OP but for the people who get here from Google results.
    But, yes... assume I don't know to read when this was posted.
    Offline

    3
    ReputationRep:
    (Original post by declique)
    Are you from the late police? This is the 3rd result in Google for "prim kruskal" so I didn't do it for the OP but for the people who get here from Google results.
    But, yes... assume I don't know to read when this was posted.
    Oh sorry, my mind reading machine wasn't working at that precise moment.

    My bad.
    Offline

    2
    ReputationRep:
    Prim's is easier to draw.

    Aside from that, Prim's selects edges only from the set of edges that are adjacent to those you have already put in your tree. Kruskal's selects edges from the set of all possible edges.
    Offline

    0
    ReputationRep:
    (Original post by edmundwillis)
    The attachments are from an OCR (MEI) cheatsheet but I am sure Edexcel will tackle these questions in the same way.

    Hopefully, they make the different methods simple enough.
    you sir may have just got me the B I need in maths!
    Offline

    3
    i like Prim's... i used not to like the matrix method but it is OK now

    one of my textbooks says you should also check that Prim's does not form a cycle but i guess that is just a mistake.

    Prim's reminds me of Pimms...
    Offline

    0
    ReputationRep:
    then why is prims algorithm easily adapted to a distance matrix??
    Offline

    1
    ReputationRep:
    sorry im 5 years late
    Offline

    1
    ReputationRep:
    (Original post by Nabzy8)
    sorry im 5 years late
    You're almost 10 year late! haha!

Reply

Submit reply

Register

Thanks for posting! You just need to create an account in order to submit the post
  1. this can't be left blank
    that username has been taken, please choose another Forgotten your password?
  2. this can't be left blank
    this email is already registered. Forgotten your password?
  3. this can't be left blank

    6 characters or longer with both numbers and letters is safer

  4. this can't be left empty
    your full birthday is required
  1. Oops, you need to agree to our Ts&Cs to register
  2. Slide to join now Processing…

Updated: January 11, 2016
TSR Support Team

We have a brilliant team of more than 60 Support Team members looking after discussions on The Student Room, helping to make it a fun, safe and useful place to hang out.

Poll
How do you eat your pizza
Useful resources

Make your revision easier

Maths

Maths Forum posting guidelines

Not sure where to post? Read here first

Equations

How to use LaTex

Writing equations the easy way

Student revising

Study habits of A* students

Top tips from students who have already aced their exams

Study Planner

Create your own Study Planner

Never miss a deadline again

Polling station sign

Thinking about a maths degree?

Chat with other maths applicants

Can you help? Study help unanswered threads

Groups associated with this forum:

View associated groups
Study resources

The Student Room, Get Revising and Marked by Teachers are trading names of The Student Room Group Ltd.

Register Number: 04666380 (England and Wales), VAT No. 806 8067 22

Registered Office: International House, Queens Road, Brighton, BN1 3XE

Quick reply
Reputation gems: You get these gems as you gain rep from other members for making good contributions and giving helpful advice.