[Tutor] python question

Thejal Ramesh thejal.3287 at gmail.com
Sun Aug 18 00:35:52 EDT 2019


Hi, i have a question regarding this question. I'm not quite sure what the
question is asking.
Part A: Popular (1.5 Marks)
 Write a function popular(graph list, n) that returns a list of people who
have at least n friends. Each person is identified by the number of their
vertex.
Input: a nested list graph list that represents a graph as an adjacency
list, that models the friendships at Monash; and a non-negative integer n.
Output: a list of integers, where each integer is a person with at least n
friends. If no person has at least n friends, return an empty list. The
list may be in any order.
 Examples clayton_list = [ [1,2,3], [0,3], [0,4], [0,1], [2] ]
The example graph clayton list is provided for illustrative purpose. Your
implemented function must be able to handle arbitrary graphs in list form
. a) Calling popular(clayton list,2) returns [0,1,2,3].
 b) Calling popular(clayton list,3) returns [0]
. c) Calling popular(clayton list,0) returns [0,1,2,3,4].


More information about the Tutor mailing list