Question: An Erdos-Renyi random graph G(n,p) is generated by two parameters -n: the number of vertices. -p: a number in [0,1], which is the probability that

An Erdos-Renyi random graph G(n,p) is generated by two parameters

-n: the number of vertices.

-p: a number in [0,1], which is the probability that each of the n(n-1)/2 edges is independently included in the graph.

Computing the size of the largest connected component. Given a graph G and a threshold t, write a function to test whether G contains a connected component of t vertices or more.

Input: a graph G and and a number t

Output: 1 if G contains a connected component of t vertices or more; 0 otherwise.

Hint: One solution is the following. For each vertex, you can compute the number of vertices in its connected component by BFS or DFS. Then, the function returns 1 if there exists a vertex whose connected component has at least t vertices. There are much faster ways to do this using BFS or DFS.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!