Hello! I'm trying to write an implementation of Prim's algorithm for finding the minimum spanning tree of a graph, using the found implementation of this algorithm in C++ ( https://evileg.com/ru/post/524/ ). When I run my code, I get Null as a result. I tried to display not the spanning tree itself, but, for example, the noedge variable. The answer is displayed as correct, but Null is still assigned next to it. Could you please tell me where the error is in my code and why does Null appear in output regardless of what my function returns?
Try changing
While[noedge<num-1, ... ] Graph[vert,EdgeWeight->weights]
to
While[noedge<num-1, ... ]; Graph[vert,EdgeWeight->weights]