You will write three tests for a connected graph given as a list of edges on the vertices 0 to n - 1.
Your tasks.
odd_vertices(n, edges). Return the list of vertices of odd degree.euler_kind(n, edges). Return "circuit" with no odd vertex, "trail" with exactly two, and "none" otherwise.two_colour(n, edges). Return a list of colours 0 and 1, one per vertex, with joined vertices coloured differently, or None if that is impossible.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…