Question: # An acquaintance graph is a directed graph in which each vertex # represents a person and each edge (a, b) symbolizes that person #a
# An acquaintance graph is a directed graph in which each vertex # represents a person and each edge (a, b) symbolizes that person #a knows person b. A celebrity is a person who knows nobody but # is known by everybody. We assume the graph has no loops. # Given an adjacency matrix for an acquaintance graph, find the # celebrity (if there is one) by checking the fewest possible # matrix entries. # In other words, write the most effecient code possible for the function called # findCeleb(adjMatrix) using python, tracking the number of times an entry in the adjacency # matrix is accessed using a counter. # This function finds the celebrity (if there is one) and tracks the # number of checks of entries in the adjacency matrix. The input is # the adjacency matrix and the output is a list in which the first element # is the celebrity number (or -1 if no celebrity is present) and the second # element is the number of checks to entries in the matrix
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
