For a random simple graph of nodes N , edges N and uniform probability of edge p, what is the expected size of the largest connected component?
- The only input parameter is N , which represents the number of nodes in the graph.
- The graph is simple, which means that it is not allowed to contain any self-tests.
- There are N node pairs, i.e. the egist is of the form
{(1,a), (2,b), (3,c), ..., (N,[next available letter of the alphabet])} . The condition is that a! = 1, b! = 2, c! = 3, etc., but besides this, a, b, c, ... can take any value from 1 to N inclusive - node n forming an edge with some other node can be described using a uniform probability distribution
- In fact, such an admissible graph constructed from nodes N and N will find the size of the largest connected component S
- Under a connected component, this is defined as the largest cluster / group of nodes, where each node in a connected component can reach / reach from all other nodes in the same connected component
The question arises: among all such regular graphs constructed, the expected value of S is expected?
I would like to learn about an effective way to think / analyze / solve this problem, which can deal with N in the range from 2 to 50 inclusive. Some code for illustration would be helpful to my understanding.
I wrote the following sources for naive brute force capabilities, hoping to find a pattern from there. Managed to get to N = 9 using these:
Both attempts to generate all possible permutations in accordance with the criteria specified in the problem, and then calculate S for each graph generated through BFS.
Data output
Regarding the format, for example. for the line " N=4: {2:3,4:78} 106/27 " this means that there are 3 graphs with the size of the largest component = 2 and 78 graphs with the size of the largest component = 4, so the final answer = (3/(78+3))*2 + (78/(78+3))*4 = 106/27 .
N=2: {2:1} 2/1 N=3: {3:8} 3/1 N=4: {2:3,4:78} 106/27 N=5: {3:80,5:944} 155/32 N=6: {2:15,3:640,4:1170,6:13800} 17886/3125 N=7: {3:840,4:21840,5:19824,7:237432} 38563/5832 N=8: {2:105,3:17920,4:229320,5:422912,6:386400,8:4708144} 6152766/823543 N=9: {3:153440,4:786240,5:9634464,6:9273600,7:8547552,9:105822432} 17494593/2097152
edit: The just discovered OEIS Sequence # A000435 gives answers (formula / enumeration up to N = 18) for graph numbers with N nodes and the largest component of size = N. This exactly matches my bruteforce result, for example. for N = 9 there are 105822432 graphs with the largest connected component size = 9. Not sure if this helps - one of the formulas given here to get this for a larger N is a(n) = (n-1)! * Sum (n^k/k!, k=0..n-2) a(n) = (n-1)! * Sum (n^k/k!, k=0..n-2) Python implementation
Example for N = 4 :
There are a total of 81 possible boundary assignments for 4 nodes (based on index 1 from 1 to N ).
The format of the output example is below: ((1, 2), (2, 1), (3, 1), (4, 1)): 4 means that there are edges between nodes 1 and 2, nodes 2 and 1, nodes 3 and 1, as well as nodes 4 and 1. Assume that the edges are not oriented / bidirectional. For such a graph, there is only one communication component from all 4 nodes {1,2,3,4}, so the size of the largest (single) communication component is 4.
After creating this list, the expected value of S can be calculated through (fraction of all 81 instances where S == 4) * 4 + (fraction of all 81 instances where S == 2) * 2 = 106/27 - since the only values ββof S are 2.4.
{((1, 2), (2, 1), (3, 1), (4, 1)): 4, ((1, 2), (2, 1), (3, 1), (4, 2)): 4, ((1, 2), (2, 1), (3, 1), (4, 3)): 4, ((1, 2), (2, 1), (3, 2), (4, 1)): 4, ((1, 2), (2, 1), (3, 2), (4, 2)): 4, ((1, 2), (2, 1), (3, 2), (4, 3)): 4, ((1, 2), (2, 1), (3, 4), (4, 1)): 4, ((1, 2), (2, 1), (3, 4), (4, 2)): 4, ((1, 2), (2, 1), (3, 4), (4, 3)): 2, ((1, 2), (2, 3), (3, 1), (4, 1)): 4, ((1, 2), (2, 3), (3, 1), (4, 2)): 4, ((1, 2), (2, 3), (3, 1), (4, 3)): 4, ((1, 2), (2, 3), (3, 2), (4, 1)): 4, ((1, 2), (2, 3), (3, 2), (4, 2)): 4, ((1, 2), (2, 3), (3, 2), (4, 3)): 4, ((1, 2), (2, 3), (3, 4), (4, 1)): 4, ((1, 2), (2, 3), (3, 4), (4, 2)): 4, ((1, 2), (2, 3), (3, 4), (4, 3)): 4, ((1, 2), (2, 4), (3, 1), (4, 1)): 4, ((1, 2), (2, 4), (3, 1), (4, 2)): 4, ((1, 2), (2, 4), (3, 1), (4, 3)): 4, ((1, 2), (2, 4), (3, 2), (4, 1)): 4, ((1, 2), (2, 4), (3, 2), (4, 2)): 4, ((1, 2), (2, 4), (3, 2), (4, 3)): 4, ((1, 2), (2, 4), (3, 4), (4, 1)): 4, ((1, 2), (2, 4), (3, 4), (4, 2)): 4, ((1, 2), (2, 4), (3, 4), (4, 3)): 4, ((1, 3), (2, 1), (3, 1), (4, 1)): 4, ((1, 3), (2, 1), (3, 1), (4, 2)): 4, ((1, 3), (2, 1), (3, 1), (4, 3)): 4, ((1, 3), (2, 1), (3, 2), (4, 1)): 4, ((1, 3), (2, 1), (3, 2), (4, 2)): 4, ((1, 3), (2, 1), (3, 2), (4, 3)): 4, ((1, 3), (2, 1), (3, 4), (4, 1)): 4, ((1, 3), (2, 1), (3, 4), (4, 2)): 4, ((1, 3), (2, 1), (3, 4), (4, 3)): 4, ((1, 3), (2, 3), (3, 1), (4, 1)): 4, ((1, 3), (2, 3), (3, 1), (4, 2)): 4, ((1, 3), (2, 3), (3, 1), (4, 3)): 4, ((1, 3), (2, 3), (3, 2), (4, 1)): 4, ((1, 3), (2, 3), (3, 2), (4, 2)): 4, ((1, 3), (2, 3), (3, 2), (4, 3)): 4, ((1, 3), (2, 3), (3, 4), (4, 1)): 4, ((1, 3), (2, 3), (3, 4), (4, 2)): 4, ((1, 3), (2, 3), (3, 4), (4, 3)): 4, ((1, 3), (2, 4), (3, 1), (4, 1)): 4, ((1, 3), (2, 4), (3, 1), (4, 2)): 2, ((1, 3), (2, 4), (3, 1), (4, 3)): 4, ((1, 3), (2, 4), (3, 2), (4, 1)): 4, ((1, 3), (2, 4), (3, 2), (4, 2)): 4, ((1, 3), (2, 4), (3, 2), (4, 3)): 4, ((1, 3), (2, 4), (3, 4), (4, 1)): 4, ((1, 3), (2, 4), (3, 4), (4, 2)): 4, ((1, 3), (2, 4), (3, 4), (4, 3)): 4, ((1, 4), (2, 1), (3, 1), (4, 1)): 4, ((1, 4), (2, 1), (3, 1), (4, 2)): 4, ((1, 4), (2, 1), (3, 1), (4, 3)): 4, ((1, 4), (2, 1), (3, 2), (4, 1)): 4, ((1, 4), (2, 1), (3, 2), (4, 2)): 4, ((1, 4), (2, 1), (3, 2), (4, 3)): 4, ((1, 4), (2, 1), (3, 4), (4, 1)): 4, ((1, 4), (2, 1), (3, 4), (4, 2)): 4, ((1, 4), (2, 1), (3, 4), (4, 3)): 4, ((1, 4), (2, 3), (3, 1), (4, 1)): 4, ((1, 4), (2, 3), (3, 1), (4, 2)): 4, ((1, 4), (2, 3), (3, 1), (4, 3)): 4, ((1, 4), (2, 3), (3, 2), (4, 1)): 2, ((1, 4), (2, 3), (3, 2), (4, 2)): 4, ((1, 4), (2, 3), (3, 2), (4, 3)): 4, ((1, 4), (2, 3), (3, 4), (4, 1)): 4, ((1, 4), (2, 3), (3, 4), (4, 2)): 4, ((1, 4), (2, 3), (3, 4), (4, 3)): 4, ((1, 4), (2, 4), (3, 1), (4, 1)): 4, ((1, 4), (2, 4), (3, 1), (4, 2)): 4, ((1, 4), (2, 4), (3, 1), (4, 3)): 4, ((1, 4), (2, 4), (3, 2), (4, 1)): 4, ((1, 4), (2, 4), (3, 2), (4, 2)): 4, ((1, 4), (2, 4), (3, 2), (4, 3)): 4, ((1, 4), (2, 4), (3, 4), (4, 1)): 4, ((1, 4), (2, 4), (3, 4), (4, 2)): 4, ((1, 4), (2, 4), (3, 4), (4, 3)): 4}