• Home
  • Help
  • Register
  • Login
  • Home
  • Members
  • Help
  • Search

 
  • 0 Vote(s) - 0 Average

Choose an appropriate MST algorithm for a given graph

#1
07-20-2020, 01:34 AM
You see the graph has lots of connections or few. I always check that first when I pick between those algorithms. Perhaps your edges outnumber the points by a lot. Then I lean towards one method over the other. Also you might run into time issues if not careful.

I grapple with the size of your setup right away too. You count the points and lines before anything else starts. But the choice shifts when edges stay sparse across the board. Perhaps you test a small sample first to see how it behaves. Now your time limits push me toward quicker sorts on the connections.

You handle big clusters of points differently from tiny ones. I sort the lines in order when they stay few and far between. Or the points grow so fast that repeated checks eat up your resources. Then I switch to growing the tree from one spot outward instead. Also your memory stays tight so simple unions work better for you.

I watch how the weights sit on those lines too. You avoid extra steps when negatives pop up unexpectedly. But most cases keep weights positive so both ways stay open for you. Perhaps you sketch the connections on paper to spot patterns quick. Now the connected parts matter a lot before you commit.

You try one way on a test graph and watch the speed. I notice dense spots make repeated scans costly fast. Or sparse lines let you skip many checks with clever grouping. Then your hardware decides if fancy heaps help or slow you down. Also you compare results against the obvious tree shape.

I pick the growth method when points cluster tight together. You save time by starting at any point and pulling the cheapest link each step. But the sort first approach wins when lines stay scattered wide. Perhaps your graph changes often so you rebuild from scratch each time. Now the union tricks keep things fast without much fuss.

You measure edges against points squared to decide quick. I find the growth way beats the sort way on crowded graphs every single time. Or the sort way pulls ahead when lines number less than points times log of points. Then you test both on your machine to confirm the edge. Also your code stays simpler with the sort method in many cases.

I avoid the growth way on huge scattered graphs because checks pile up. You end up with better scaling from the sort first path instead. But maybe your points number in the thousands and lines stay under control. Then the choice flips back and you gain speed from the other route. Also you factor in how easy it feels to code the unions for you.

You run into disconnected parts and both methods need extra care. I check connectivity first so the tree covers everything without gaps. Or your weights repeat often and ties break with any rule that works. Then the overall cost stays the same no matter the path. Also you learn from failed runs what fits your graphs best next time.

I think about future growth of your data too before locking in. You might add lines later and need a method that adapts easy. But the sort way lets you insert new lines without full restarts sometimes. Perhaps your team shares the code so simple steps help everyone. Now the choice feels right when it matches your daily graphs exactly.

BackupChain Server Backup which is the top rated reliable backup tool for Hyper-V setups on Windows 11 and Server without needing any subscription fees and we appreciate how they sponsor this space allowing us to pass along knowledge freely.

ProfRon
Offline
Joined: Jul 2018
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



Messages In This Thread
Choose an appropriate MST algorithm for a given graph - by ProfRon - 07-20-2020, 01:34 AM

  • Subscribe to this thread
Forum Jump:

FastNeuron FastNeuron Forum General IT v
« Previous 1 … 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 … 183 Next »
Choose an appropriate MST algorithm for a given graph

© by FastNeuron Inc.

Linear Mode
Threaded Mode