Edge B-E is skipped because both of its endpoints (B and E) are already in the visited set (MST). Prim's algorithm only considers edges that connect a visited vertex to an unvisited vertex to avoid creating cycles.
Conditions: Both endpoints of the edge are already marked as visited.; The algorithm strictly follows the rule of adding only crossing edges.
Edge B-E is skipped because both of its endpoints (B and E) are already in the visited set (MST). Prim's algorithm only considers edges that connect a visited vertex to an unvisited vertex to avoid creating cycles.
Conditions: Both endpoints of the edge are already marked as visited.; The algorithm strictly follows the rule of adding only crossing edges.
When multiple candidate edges share the same minimum weight, you can pick any one of them. The choice does not affect the validity of the greedy step, though it may lead to a different MST if edge weights are not distinct.
Conditions: Multiple edges connect the visited set to unvisited nodes.; These edges have identical minimum weights.
When multiple candidate edges share the same minimum weight, you can pick any one of them. The choice does not affect the validity of the greedy step, though it may lead to a different MST if edge weights are not distinct.
Conditions: Multiple edges connect the visited set to unvisited nodes.; These edges have identical minimum weights.
Edge A-B is chosen first because Prim's algorithm is a greedy algorithm that selects the smallest edge connecting the current visited set to an unvisited node. From the starting node A, edge A-B has the minimum weight among all edges incident to A leading to unvisited nodes.
Conditions: Node A is the starting visited node.; The algorithm follows the greedy rule of picking the minimum-weight crossing edge.
Edge A-B is chosen first because Prim's algorithm is a greedy algorithm that selects the smallest edge connecting the current visited set to an unvisited node. From the starting node A, edge A-B has the minimum weight among all edges incident to A leading to unvisited nodes.
Conditions: Node A is the starting visited node.; The algorithm follows the greedy rule of picking the minimum-weight crossing edge.