You will write three functions for a graph stored as a list of edges, such as [(0, 1), (1, 2)], on the vertices 0 to n - 1.
Your tasks.
degrees(n, edges). Return the list of degrees.handshake_ok(n, edges). Return True when the sum of the degrees is twice the number of edges.component(n, edges, start). Return the set of vertices reachable from start.Run your code once to unlock the worked solution.
Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…