Question kruskal algoritm

andrews

Well-known member
Joined
Nov 22, 2011
Messages
167
Programming Experience
5-10
Is a Kruskal algorithm possible in vb.net and can I find the code on the internet ?
Thanks for any response.
 
Is a Kruskal algorithm possible in vb.net
Yes.
can I find the code on the internet?
You tell us. If you searched and you found it then yes. If you searched and didn't find it then no. If you didn't search then... why didn't you search? Is this an assignment of some sort? I'm guessing that you're actually supposed to implement it yourself, but I could be wrong.
 
I am a newbie, thus I ask the experts.
I know that Kruskal Algorithm is best solved with a kind of pointers (lists?) and I know too that vb.net has no pointers but maybe there is a way to get around (treeview?)
And yes I am trying to find something and my idea is to use Dictionaries in an array bur I have still to code that.
But I waiting too during this time for the experts.
 
I Googled kruskal vb.net and found an implementation. That took me about 3 seconds. I have to wonder why, if I can do that, you can't. I'm all for using forums when you have tried to solve a problem and can't but asking us if you can find something on the web instead of trying to find it on the web first is not what I would suggest as the right way around to do things.

I don't know much about this algorithm but I very much doubt that there's anything about it that inherently requires pointers. That just how it would be implemented in languages that use pointers a lot, e.g. C/C++.
 
I found no good solution on the Internet.
I got now a solution with the array of Dictionaries but I know it is not the most performant.
I am trying now to get a better solution with Listview or Treeview where pointers are (not explicitly) build in I guess.
Jmcilhenny, thanks for your interesting on this problem.
 
You would not use a ListView or a TreeView under any circumstances. They are controls and are only for allowing the user to view and interact with data. This code has nothing to do with a user so there should be no UI. Forget pointers. You do not need pointers to solve this problem and you certainly don't need controls.

I don't understand how I can find this:

Kruskal/Kruskal.VB from the code source KRUSKAL - EN CONSOLE Fullscreen Visual Basic, VB6, VB.NET, VB 2005, VB ☼ CodeS-SourceS Files, browse 50 396 019 lines of code available inside the zip files of Code

in a couple of seconds on Google and you can't find anything.
 
If you think about it, all .Net languages contain mostly only pointers. Every time you assign a type to a variable, that variable contains only a pointer to the object in memory.

Besides, I am unaware of any algorithm that has specific requirements in its implementation. Sure some implementations will be more efficient than others, but the whole point of an algorithm is to provide information as to how to produce an implementation. Do you HAVE to use a multiplication instruction to obtain a product? Surely you can obtain the same result with only successive additions, it will just take more time.
 
At the bottom of the Wikipedia article there are links to implementations in Java, C++ and C#. I would suggest you look at those implementations and try to convert the code over to VB. That is what I did with the SieveOfAtkin algorithm and, while it posed some issues, I learned a lot (at least regarding differences in syntax between languages and troubleshooting in general) during the process.
 
I know now that the best implementation for the Kruskal algprithm must use Linked Lists wich uses nodes who have pointers to next nodes.
I have to learn now Linked Lists wich is not an basic object in VB.net.
Thanks for the informations.
 
I know now that the best implementation for the Kruskal algprithm must use Linked Lists wich uses nodes who have pointers to next nodes.
I have to learn now Linked Lists wich is not an basic object in VB.net.
Thanks for the informations.
Did you somehow miss the LinkedList(Of T) class? I told you to forget pointers and I'm telling you again: forget pointers. VB can do what you want to do without pointers. A LinkedList(Of T) contains LinkedListNode(Of T) items. Each node has Next and Previous properties, which refer to the next and previous items in the list, and a Value property, which contains the data for the node. That's all without any exposed pointer in sight.
 
Yes, sorry, I didn't knew that there was a class LinkedList in vb.net.
Was this already the case in much older versions?
Thanks !
 
Back
Top