Menu
support@authoritypapers.com
+1(805) 568 7317

python3 write the function max clique friends which takes in a dictionary in the for 5153777

Python3: Write the function max_clique(friends), which takes in a dictionary in the format above, and returns the largest clique that can be found, as a list. (If there are several such cliques, return one of them.) For example, the largest clique in the example above is [“Carl Gauss”, “Isaac Newton”, “Charles Babbage”], since there is no clique of size larger than 3.

Specific information is on the graph

Restrictions: list comprehension, ,lambda function slicing can't be used, unless this question has can't be solved wihout for loop and 'in' keyword, otherwise in keyword and for loop can't be used. It is recommended to use while loop instead of for loop to solve this problem

We can use a dictionary to record who is friends with whom by recording the lists of friends in a dictionary. For example: fr

We can use a dictionary to record who is friends with whom by recording the lists of friends in a dictionary. For example: friends = {“Carl Gauss”: [“Isaac Newton”, “Gottfried Leibniz”, “Charles Babbage”] , “Gottfried Leibniz”: [“Carl Gauss”] , “Isaac Newton”: [“Carl Gauss”, “Charles Babbage”], “Ada Lovelace”: [“Charles Babbage”, “Michael Faraday”]} “Charles Babbage”: [“Isaac Newton”, “Carl Gauss”, “Ada Lovelace”], “Michael Faraday”” [“Ada Lovelace”) } Here, Carl Gauss is friends with Isaac Newton, Gottfried Leibniz, and Charles Babbage. Assume that friendships are symmetric, so that if X is friends with Y, then it's guaranteed that Y is friends with X. A clique is defined as a group of friends where everyone is friends with everyone. For example, Carl Gauss, Isaac Newton, and Charles Babbage form a clique in the example above, since all three are friends with each other. Ada Lovelace and Michael Faraday also form a clique. Write the function max_clique(friends), which takes in a dictionary in the format above, and returns the largest clique that can be found, as a list. (If there are several such cliques, return one of them.) For ex- ample, the largest clique in the example above is [“Carl Gauss”, “Isaac Newton”, “Charles Babbage”], since there is no clique of size larger than 3. def max_clique (friends):

"Order a similar paper and get 15% discount on your first order with us
Use the following coupon
"GET15"

Order Now