سؤال

Is there a minimum spanning tree in a non-planar graph? I have read about prim algorithm and triangle inequality and my graph doesn't satisfy the triangle inequality?

هل كانت مفيدة؟

المحلول

In the proof of correctness I read of prim's algorithm here, triangle inequality was not used once. So prim's algorithm should be valid for non-metric graphs(those that do not satisfy triangle inequality) too. So you can apply prim's algorithm to find the MST for a connected weighted undirected graph.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top