I am working on an algorithm to check if a given edge is included in one of all possible mst\'s.
For this question, we are considering non-distinct values and our edge e
In order to check if one edge should be in the MST, you should instead start from checking if adding this edge to the graph creates a cycle, we all know that MST can't have any cycles.
If it does, then just to figure out which route of the at least two routes has the less weight. If your edge e has the minimum weight, then it should be in the MST, otherwise it is just an edge that could form a cycle plus is not the best edge to include in the graph.
If it doesn't, it has to be in the MST unless any later edge coming into play and beat the existing one.
By doing so, you can achieve O(n) time checking if edge is in the MST.