Skip to content
Snippets Groups Projects
Commit 8249eb60 authored by Samuel Koovely's avatar Samuel Koovely
Browse files

fix typo ES4E2

parent 4a891534
No related branches found
No related tags found
No related merge requests found
%% Cell type:markdown id: tags:
# EXERCISE SHEET 2, EXERCISE 2: Giant Component in ER-Model
# EXERCISE SHEET 4, EXERCISE 2: Giant Component in ER-Model
%% Cell type:markdown id: tags:
The goal of this exercise is to observe and verify the behaviour of the ER-Model under different parameter specifications.
%% Cell type:code id: tags:
``` python
#import the neccessary packages
```
%% Cell type:markdown id: tags:
# QUESTION 1:
Generate a function that samples instances of ER-$G(N,p)$ models. Given a simple graph G = (V,E), the probability that your function outputs G should be equal to $p^M (1-p)^{\binom{N}{2}-M}$, where $M \coloneqq |E|$.
Your function could follows this sturcture:
- Take as inputs two paramters $N \in \mathbb{N}$ and $p \in [0,1]$;
- Create an empty undirected networkx graph with $N$ nodes;
- Loop over each pair of nodes $(i,j)$ and with probability $p$, add an edge between $i$ and $j$;
- Return the graph.
Generate a few test graphs, compute their average degree and plot their degree distributions. Verify that the results you obtain are consistent with what you expect from the analytical derivations of the lecture.
%% Cell type:markdown id: tags:
# Answer 1:
%% Cell type:code id: tags:
``` python
```
%% Cell type:markdown id: tags:
# QUESTION 2:
In the second part of the exercise we want to generate various instances of ER-models. For each $n \in \{ 25, 100, 500, 2000 \}$:
- Find (matemathically, not numerically) the critical values $\tilde{p} \in [0,1]$ at which $G(n, \tilde{p})$ transitions from the regime with many small components to the regime with one giant component.
- Use your previously defined function to generate graphs in three regimes: below $\tilde{p}$, at $\tilde{p}$, and above $\tilde{p}$ (avoid the trivial cases $p \in \{ 0,1 \}$).
In total you should have 12 graphs.
%% Cell type:markdown id: tags:
# Answer 2:
%% Cell type:code id: tags:
``` python
```
%% Cell type:markdown id: tags:
# QUESTION 3:
%% Cell type:markdown id: tags:
Plot the graphs as 4 by 3 subplots.
As a suggestion, put $N$ on the $x$ axis (increasing left to right); and the density regimes on the $y$ axis (increasing from top to bottom).
%% Cell type:markdown id: tags:
# Answer 3:
%% Cell type:code id: tags:
``` python
```
%% Cell type:markdown id: tags:
# QUESTION 4:
What do you observe in your plots?
%% Cell type:markdown id: tags:
# Answer 4:
%% Cell type:markdown id: tags:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment