Question: A vertex u in a directed graph is defined as a black-hole vertex if there is an edge from every other vertex to u,
A vertex u in a directed graph is defined as a black-hole vertex if there is an edge from every other vertex to u, and there is no edge from u to any other vertex. Given the adjacency matrix representation G, design an algorithm to decide if G contains a black-hole vertex. Your algorithm should run in O(|V|) time. (The time to load the adjacency matrix does not count towards to the running time.)
Step by Step Solution
3.43 Rating (143 Votes )
There are 3 Steps involved in it
As described in the problem a Black Hole vertex is the one having indegree V1 and outdegree as 0 In ... View full answer
Get step-by-step solutions from verified subject matter experts
