Synopsys VCS can analyze connectivity relationships among modules, ports, or signal endpoints. Given an undirected graph where every connection has unit distance, find the shortest path between two specified nodes.
Return the minimum number of edges needed to travel from source to target. If no path exists, return -1.
Implement shortest_path(n, edges, source, target), where:
n is the number of vertices labeled 0 through n - 1.edges is a list of two-element lists [u, v], representing an undirected edge between u and v.source and target are valid vertex labels.-1 when the target is unreachable.def shortest_path(n, edges, source, target):