All problems
G(n,p) Connectivity Threshold Check
Problem
The Erdos-Renyi graph G(n, p) passes the connectivity threshold when p is above log(n) / n. Return True when p > log(n) / n and False otherwise.
Return True for n < 2, where the graph is trivially connected.
Hint
Below the threshold isolated vertices appear with high probability.
Test cases
case 1
in: [100,0.1]
expected: true
case 2
in: [100,0.01]
expected: false
case 3
in: [10,0.5]
expected: true
case 4
in: [10,0.1]
expected: false
Starter codePython
import math
def gn_p_connectivity_check(n, p):
# Your code here
pass4 test cases · run your code against them in the editor