Describe an algorithm that checks if edge e is in MST of G

1.1k Views Asked by At

I have an exercise in algorithms with this question: G is connected weighted graph, and I need to describe a linear time algorithm that checks if there exists a minimum spanning Tree that contains the edge e.

let edge e=(u,v), so I thought about starting building an MST from u and check if edge e is safe to add to the MST (for example by using prim algorithm). and doing the same starting from v. Will it work?