Question: Give pseudocode (or, if you prefer, Python code) for a subroutine that takes as input a directed graph in the Python version of the adjacency
Give pseudocode (or, if you prefer, Python code) for a subroutine that takes as input a directed graph in the Python version of the adjacency list representation, and produces as output a dictionary that maps each vertex to its in-degree (number of incoming edges). Your subroutine must take onlyO(m) time; solutions that takeO(m) time per vertex, for a total ofO(mn) time, will not be accepted as correct. You may assume that setting or getting a single dictionary entry takesO(1) time
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
