Files
ethp2psim/ipython/Results.ipynb
2023-03-02 14:55:39 +00:00

849 lines
25 KiB
Plaintext

{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "7010b857-43d5-4392-abcb-ee77c3db7936",
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b39afa5a-f797-4de4-b528-17d502d43b60",
"metadata": {},
"outputs": [],
"source": [
"import plotly.express as px\n",
"from plotly.offline import init_notebook_mode\n",
"\n",
"init_notebook_mode(connected=False)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "68424718-24ad-4f7b-882a-8eb538a38754",
"metadata": {},
"outputs": [],
"source": [
"import sys\n",
"\n",
"from ethp2psim.experiments import (\n",
" extract_config_columns,\n",
" prepare_results_for_visualization,\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "db251c62-f976-40c5-88c7-7a05e55f6523",
"metadata": {},
"outputs": [],
"source": [
"def filter_estimator(\n",
" df: pd.DataFrame, value: str, col: str = \"estimator\"\n",
") -> pd.DataFrame:\n",
" return df[df[col] == value].copy()\n",
"\n",
"\n",
"def load_results(fname, only_first_sent=False):\n",
" df = pd.read_csv(fname)\n",
" if \"goerli\" in fname:\n",
" df[\"graph_model\"] = \"goerli_testnet\"\n",
" else:\n",
" df[\"graph_model\"] = \"random_regular\"\n",
" if \"active_adversary\" in fname:\n",
" df[\"adversary_type\"] = \"active\"\n",
" else:\n",
" df[\"adversary_type\"] = \"passive\"\n",
" if \"degree\" in fname:\n",
" df[\"adversary_centrality\"] = \"degree\"\n",
" else:\n",
" df[\"adversary_centrality\"] = \"none\"\n",
" if \"bc_all\" in fname:\n",
" df[\"broadcast_mode\"] = \"all\"\n",
" else:\n",
" df[\"broadcast_mode\"] = \"sqrt\"\n",
" print(df.shape)\n",
" # shorten protocol names before visualization\n",
" df = extract_config_columns(df)\n",
" if only_first_sent:\n",
" df = filter_estimator(df, \"first_sent\")\n",
" print(df.shape)\n",
" return df\n",
"\n",
"\n",
"def update_figure(fig, width=1000, height=1000):\n",
" fig.update_layout(\n",
" width=width,\n",
" height=height,\n",
" )\n",
" fig.update_layout(\n",
" legend=dict(orientation=\"h\", yanchor=\"bottom\", y=1.02, xanchor=\"left\", x=0.0)\n",
" )"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "0b0764f5-a845-4421-aa34-bc8a2a74fea6",
"metadata": {},
"outputs": [],
"source": [
"experiment_dir = \"../scripts/fifth_round_results/\"\n",
"figures_dir = \"../figures/\"\n",
"rewrite_fig = True"
]
},
{
"cell_type": "markdown",
"id": "28ac3cab-bc5b-48fd-9f8b-12bc20734ece",
"metadata": {},
"source": [
"# 1. Results with passive adversary"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f5ae7ba3-9de6-4728-955c-b315477de6c8",
"metadata": {},
"outputs": [],
"source": [
"passive_random_df = load_results(\n",
" \"%s/random_regular_1000_none_with_dandelions.csv\" % experiment_dir\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "958cfb04-1ca3-4e01-9b40-35436db4857d",
"metadata": {},
"outputs": [],
"source": [
"passive_goerli_df = load_results(\n",
" \"%s/goerli_none_with_dandelions.csv\" % experiment_dir, only_first_sent=True\n",
")"
]
},
{
"cell_type": "markdown",
"id": "0f93b9f8-7dae-4027-a7c1-6694eb627e67",
"metadata": {},
"source": [
"## i.) Estimator comparison: first reach vs. first sent\n",
"\n",
"- random regular graph with 1000 nodes and 50 degree\n",
"- 5% of all nodes send messages (~ number of messages)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c8a38d33-0390-47c6-a0a6-0eda56ab3cfa",
"metadata": {},
"outputs": [],
"source": [
"passive_random_results = prepare_results_for_visualization(passive_random_df)"
]
},
{
"cell_type": "markdown",
"id": "05ec4d83-5b72-4ca4-87da-282ae3039b81",
"metadata": {},
"source": [
"### Observations (only sanity check)\n",
"\n",
"- Adversary is more efficient with higher adversary ratio - **OK**\n",
"- Adversary can better deanonymize simple Broadcast than Dandelion(++) - **OK**\n",
"- Dandelion and Dandelion++ has comparable results with the same broadcast probability - **OK**\n",
"- Average message spread ratio (fraction of nodes receiving each message) is 1.0 despite the protocol - **OK**\n",
"- Note that **inverse_rank and NDCG** are better metrics than **hit_ratio** or **entropy** (see next fig.) It is shocking that for these metrics Broadcast and Dandelion protocols are much closer to each other than for hit_ratio!"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c8d6962c-9b15-44e1-85bb-a97ff73a92d5",
"metadata": {},
"outputs": [],
"source": [
"fig = px.box(\n",
" passive_random_results[~passive_random_results[\"metric\"].isin([\"entropy\",\"message_spread_ratio\"])],\n",
" x=\"adversary_ratio\",\n",
" y=\"value\",\n",
" color=\"protocol\",\n",
" facet_col=\"estimator\",\n",
" facet_row=\"metric\",\n",
")\n",
"update_figure(fig)\n",
"if rewrite_fig:\n",
" fig.write_image(\"%s/passive_estimator_check.png\" % figures_dir)\n",
"fig.show()"
]
},
{
"cell_type": "markdown",
"id": "1847828d-ba95-49ab-bf1c-9c09144adee5",
"metadata": {},
"source": [
"**Entropy is a bad metric:** it does not take into account the ground truth! there is no difference for Dandelion adversary using the first reach or first send estimator..."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "cb2ca192-d85d-46af-b818-36c63b66c34a",
"metadata": {},
"outputs": [],
"source": [
"fig = px.box(\n",
" passive_random_results[passive_random_results[\"metric\"] == \"entropy\"],\n",
" x=\"adversary_ratio\",\n",
" y=\"value\",\n",
" color=\"protocol\",\n",
" facet_col=\"estimator\",\n",
" labels={\"value\": \"entropy\"},\n",
")\n",
"update_figure(fig, height=400)\n",
"if rewrite_fig:\n",
" fig.write_image(\"%s/passive_estimator_entropy.png\" % figures_dir)\n",
"fig.show()"
]
},
{
"cell_type": "markdown",
"id": "82f2a4a6-e2d4-44b5-b2f7-b89f8a37db24",
"metadata": {},
"source": [
"# NOTE: from now on only first sent estimator results are shown!"
]
},
{
"cell_type": "markdown",
"id": "fe4aee46-eea0-48b9-9486-7d2d1be31a70",
"metadata": {},
"source": [
"## ii.) Graph model comparison: random regular vs. Goerli testnet\n",
"\n",
"- Goerli testnet has approximately 1,5K nodes and 20K edges\n",
"- 10% of all nodes send messages (~ number of messages)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "25badc70-0d0f-46b2-8a1b-da990df899c9",
"metadata": {},
"outputs": [],
"source": [
"passive_goerli_results = prepare_results_for_visualization(passive_goerli_df)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "42bdbe89-d5f9-4fc8-904a-041bc4108695",
"metadata": {},
"outputs": [],
"source": [
"passive_first_sent_results = pd.concat(\n",
" [\n",
" filter_estimator(passive_random_results, \"first_sent\"),\n",
" passive_goerli_results,\n",
" ]\n",
")"
]
},
{
"cell_type": "markdown",
"id": "6c0aa985-e7df-45c1-b0c0-6c6a0fc87462",
"metadata": {},
"source": [
"### a.) Observations with random adversary sampling (meaningful results)\n",
"\n",
"- Adversary ratio and protocol parameters trend are similar - **OK**\n",
"- In general, adversary is less effective for the Goerli testnet than for random regular graphs - **Interesting**\n",
"- Dandelion results have smaller deviation (because we use the same network structure 10 times) - **OK**"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "72f91d7e-afbd-496c-8af3-cc61e278f0ed",
"metadata": {},
"outputs": [],
"source": [
"fig = px.box(\n",
" passive_first_sent_results[~passive_first_sent_results[\"metric\"].isin([\"entropy\",\"message_spread_ratio\"])],\n",
" x=\"adversary_ratio\",\n",
" y=\"value\",\n",
" color=\"protocol\",\n",
" facet_col=\"graph_model\",\n",
" facet_row=\"metric\",\n",
")\n",
"update_figure(fig)\n",
"if rewrite_fig:\n",
" fig.write_image(\"%s/graph_model_comparision.png\" % figures_dir)\n",
"fig.show()"
]
},
{
"cell_type": "markdown",
"id": "99f95340-07fa-4899-8323-4265c9c6ee39",
"metadata": {},
"source": [
"### b.) Observations with central node selection (meaningful results)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "04ca1311-0b4a-407b-b2fe-f3f4760da004",
"metadata": {},
"outputs": [],
"source": [
"passive_random_degree_df = load_results(\n",
" \"%s/random_regular_1000_degree_with_dandelions.csv\" % experiment_dir,\n",
" only_first_sent=True,\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "601566d8-9cf1-4999-a5c5-456e4a0fe6cb",
"metadata": {},
"outputs": [],
"source": [
"passive_goerli_degree_df = load_results(\n",
" \"%s/goerli_degree_with_dandelions.csv\" % experiment_dir, only_first_sent=True\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ff5456a4-c02f-47c3-bf1f-6cec1addecf3",
"metadata": {},
"outputs": [],
"source": [
"passive_random_degree_results = prepare_results_for_visualization(\n",
" passive_random_degree_df\n",
")\n",
"passive_goerli_degree_results = prepare_results_for_visualization(\n",
" passive_goerli_degree_df\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3194a384-a001-415c-81af-fa9ee1867094",
"metadata": {},
"outputs": [],
"source": [
"passive_degree_results = pd.concat(\n",
" [\n",
" filter_estimator(passive_random_results, \"first_sent\"),\n",
" passive_goerli_results,\n",
" passive_random_degree_results,\n",
" passive_goerli_degree_results,\n",
" ]\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c890f91f-5dad-4d77-896d-91826b7490b0",
"metadata": {},
"outputs": [],
"source": [
"for metric in [\"hit_ratio\", \"inverse_rank\", \"ndcg\"]:\n",
" fig = px.box(\n",
" passive_degree_results[passive_degree_results[\"metric\"] == metric],\n",
" x=\"adversary_ratio\",\n",
" y=\"value\",\n",
" color=\"protocol\",\n",
" facet_col=\"adversary_centrality\",\n",
" facet_row=\"graph_model\",\n",
" labels={\"value\": metric},\n",
" )\n",
" update_figure(fig, 1200, 500)\n",
" if rewrite_fig:\n",
" fig.write_image(\n",
" \"%s/passive_adversary_centrality_%s.png\" % (figures_dir, metric)\n",
" )\n",
" fig.show()"
]
},
{
"cell_type": "markdown",
"id": "56e2b2df-b1b1-43cb-ae83-b485d9f7457e",
"metadata": {},
"source": [
"## iii.) Broadcast to all nodes (instead of sqrt amount of them)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1f8d6266-3b40-48a0-a4a0-9655ffa5569e",
"metadata": {},
"outputs": [],
"source": [
"passive_random_bc_all_df = load_results(\n",
" \"%s/random_regular_1000_none_with_dandelions_bc_all.csv\" % experiment_dir,\n",
" only_first_sent=True,\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d0ad3a03-5808-41a4-9124-121360c89ab2",
"metadata": {},
"outputs": [],
"source": [
"passive_goerli_bc_all_df = load_results(\n",
" \"%s/goerli_none_with_dandelions_bc_all.csv\" % experiment_dir, only_first_sent=True\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "16611da3-2528-4cbb-9814-01df866a2577",
"metadata": {},
"outputs": [],
"source": [
"passive_random_bc_all_results = prepare_results_for_visualization(\n",
" passive_random_bc_all_df\n",
")\n",
"passive_goerli_bc_all_results = prepare_results_for_visualization(\n",
" passive_goerli_bc_all_df\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "0c82dca7-93b4-4d61-a89d-377af2e057c5",
"metadata": {},
"outputs": [],
"source": [
"passive_broadcast_results = pd.concat(\n",
" [\n",
" filter_estimator(passive_random_results, \"first_sent\"),\n",
" passive_goerli_results,\n",
" passive_random_bc_all_results,\n",
" passive_goerli_bc_all_results,\n",
" ]\n",
")"
]
},
{
"cell_type": "markdown",
"id": "fde2a45f-ead0-407f-9c5b-f50c7d07dba4",
"metadata": {},
"source": [
"### Observations (meaningful results)\n",
"\n",
"- Adversary can better deanonymize if message is sent to all neighbors - **OK**"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "043ec7e7-fdaf-48c5-9f48-efc5ccf3857f",
"metadata": {},
"outputs": [],
"source": [
"for metric in [\"hit_ratio\", \"inverse_rank\", \"ndcg\"]:\n",
" fig = px.box(\n",
" passive_broadcast_results[passive_broadcast_results[\"metric\"] == metric],\n",
" x=\"adversary_ratio\",\n",
" y=\"value\",\n",
" color=\"protocol\",\n",
" facet_col=\"broadcast_mode\",\n",
" facet_row=\"graph_model\",\n",
" labels={\"value\": metric},\n",
" )\n",
" update_figure(fig, 1200, 500)\n",
" if rewrite_fig:\n",
" fig.write_image(\"%s/broadcast_mode_%s.png\" % (figures_dir, metric))\n",
" fig.show()"
]
},
{
"cell_type": "markdown",
"id": "bd912850-8979-4355-9155-7e461181803f",
"metadata": {},
"source": [
"- message spread for goerli is less in case of broadcasting to sqrt neighbors - **OK**"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "0aa1d325-0376-4dc8-a2ae-6f14feea8d50",
"metadata": {},
"outputs": [],
"source": [
"fig = px.box(\n",
" passive_broadcast_results[\n",
" passive_broadcast_results[\"metric\"] == \"message_spread_ratio\"\n",
" ],\n",
" x=\"adversary_ratio\",\n",
" y=\"value\",\n",
" color=\"protocol\",\n",
" facet_col=\"broadcast_mode\",\n",
" facet_row=\"graph_model\",\n",
" labels={\"value\": \"message_spread_ratio\"},\n",
")\n",
"update_figure(fig, 1200, 500)\n",
"if rewrite_fig:\n",
" fig.write_image(\"%s/broadcast_mode_message_spread.png\" % figures_dir)\n",
"fig.show()"
]
},
{
"cell_type": "markdown",
"id": "2757de3d-4ed6-47a5-821c-2ce227cc25ca",
"metadata": {},
"source": [
"# 2. Active vs. passive adversary"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6286c753-01d7-41ca-9b52-090e6b67ee37",
"metadata": {},
"outputs": [],
"source": [
"active_random_df = load_results(\n",
" \"%s/random_regular_1000_none_with_dandelions_active_adversary.csv\" % experiment_dir,\n",
" only_first_sent=True,\n",
")\n",
"active_random_degree_df = load_results(\n",
" \"%s/random_regular_1000_degree_with_dandelions_active_adversary.csv\"\n",
" % experiment_dir,\n",
" only_first_sent=True,\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "91ab6ba2-3bee-4e52-9494-5985e4e61960",
"metadata": {},
"outputs": [],
"source": [
"active_goerli_df = load_results(\n",
" \"%s/goerli_none_with_dandelions_active_adversary.csv\" % experiment_dir,\n",
" only_first_sent=True,\n",
")\n",
"active_goerli_degree_df = load_results(\n",
" \"%s/goerli_degree_with_dandelions_active_adversary.csv\" % experiment_dir,\n",
" only_first_sent=True,\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "145805d1-95ef-4b08-b49f-54b95ae748fa",
"metadata": {},
"outputs": [],
"source": [
"active_random_results = prepare_results_for_visualization(active_random_df)\n",
"active_goerli_results = prepare_results_for_visualization(active_goerli_df)\n",
"active_random_degree_results = prepare_results_for_visualization(\n",
" active_random_degree_df\n",
")\n",
"active_goerli_degree_results = prepare_results_for_visualization(\n",
" active_goerli_degree_df\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f0807cb4-dcf2-46f9-85ba-45a05397ad49",
"metadata": {},
"outputs": [],
"source": [
"passive_active_results = pd.concat(\n",
" [\n",
" filter_estimator(passive_random_results, \"first_sent\"),\n",
" passive_goerli_results,\n",
" active_random_results,\n",
" active_goerli_results,\n",
" ]\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "44fddb59-3485-49f4-ace1-0e01eb315148",
"metadata": {},
"outputs": [],
"source": [
"passive_active_degree_results = pd.concat(\n",
" [\n",
" active_random_results,\n",
" active_goerli_results,\n",
" active_random_degree_results,\n",
" active_goerli_degree_results,\n",
" ]\n",
")"
]
},
{
"cell_type": "markdown",
"id": "d6ca4113-0317-47c8-864a-e408d61a5b0d",
"metadata": {},
"source": [
"### Observations (meaningful)\n",
"\n",
"- Active adversary effect on message spread behaves as expected - **OK**"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "0f6b03dc-9b35-4b33-be59-bc590d53485c",
"metadata": {},
"outputs": [],
"source": [
"fig = px.box(\n",
" passive_active_results[passive_active_results[\"metric\"] == \"message_spread_ratio\"],\n",
" x=\"adversary_ratio\",\n",
" y=\"value\",\n",
" color=\"protocol\",\n",
" facet_col=\"adversary_type\",\n",
" facet_row=\"graph_model\",\n",
" labels={\"value\": \"message_spread_ratio\"},\n",
")\n",
"update_figure(fig, 1200, 500)\n",
"if rewrite_fig:\n",
" fig.write_image(\"%s/passive_vs_active_adversary_message_spread.png\" % figures_dir)\n",
"fig.show()"
]
},
{
"cell_type": "markdown",
"id": "183cfa8d-95d8-4385-9824-c95519e61304",
"metadata": {},
"source": [
"* and it is even worse if adversaries are high centrality nodes"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b2774af9-7162-4654-a1b7-579fb96b181f",
"metadata": {},
"outputs": [],
"source": [
"fig = px.box(\n",
" passive_active_degree_results[\n",
" passive_active_degree_results[\"metric\"] == \"message_spread_ratio\"\n",
" ],\n",
" x=\"adversary_ratio\",\n",
" y=\"value\",\n",
" color=\"protocol\",\n",
" facet_col=\"adversary_centrality\",\n",
" facet_row=\"graph_model\",\n",
" labels={\"value\": \"message_spread_ratio\"},\n",
")\n",
"update_figure(fig, 1200, 500)\n",
"if rewrite_fig:\n",
" fig.write_image(\n",
" \"%s/passive_vs_active_adversary_centrality_message_spread.png\" % figures_dir\n",
" )\n",
"fig.show()"
]
},
{
"cell_type": "markdown",
"id": "61288ecb-37b3-4a63-afda-9cec7668f54b",
"metadata": {},
"source": [
"- There is no significant difference in adversary performance **(as expected)**"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6f4aceee-8dfe-402d-b531-7e14ab85ace2",
"metadata": {},
"outputs": [],
"source": [
"for metric in [\"hit_ratio\", \"inverse_rank\", \"ndcg\"]:\n",
" fig = px.box(\n",
" passive_active_results[passive_active_results[\"metric\"] == metric],\n",
" x=\"adversary_ratio\",\n",
" y=\"value\",\n",
" color=\"protocol\",\n",
" facet_col=\"adversary_type\",\n",
" facet_row=\"graph_model\",\n",
" labels={\"value\": metric},\n",
" )\n",
" update_figure(fig, 1200, 500)\n",
" if rewrite_fig:\n",
" fig.write_image(\"%s/passive_vs_active_adversary_%s.png\" % (figures_dir, metric))\n",
" fig.show()"
]
},
{
"cell_type": "markdown",
"id": "3247245b-a995-4f68-9c69-3311712d332e",
"metadata": {},
"source": [
"# Node contact time experiments"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "87980262-2c2e-452f-b235-58766c8c657f",
"metadata": {},
"outputs": [],
"source": [
"def extract_contact_time_quantiles(\n",
" dataframe, group_cols=[\"protocol\"], target_col=\"mean_contact_time_quantiles\"\n",
"):\n",
" df = dataframe.copy()\n",
" df[target_col] = df[target_col].apply(eval)\n",
" mean_time_q_aggr = (\n",
" filter_estimator(df, \"first_sent\")\n",
" .groupby(group_cols)[target_col]\n",
" .sum()\n",
" .reset_index()\n",
" )\n",
" # print(mean_time_q_aggr.head())\n",
" mean_time_q_aggr[target_col] = mean_time_q_aggr[target_col].apply(\n",
" lambda x: np.mean(np.array(x).reshape(-1, 9), axis=0)\n",
" )\n",
" old_cols = set(mean_time_q_aggr.columns)\n",
" mean_time_q_aggr = mean_time_q_aggr.assign(\n",
" **pd.DataFrame(mean_time_q_aggr[target_col].values.tolist()).add_prefix(\"q_\")\n",
" )\n",
" diff_cols = sorted(list(set(mean_time_q_aggr.columns).difference(old_cols)))\n",
" visu_df = mean_time_q_aggr.melt(\n",
" id_vars=group_cols, value_vars=diff_cols, value_name=\"time\", var_name=\"quantile\"\n",
" )\n",
" replace_map = dict(zip(diff_cols, np.arange(0.1, 1.1, 0.1)))\n",
" visu_df[\"quantile\"] = visu_df[\"quantile\"].replace(replace_map)\n",
" return visu_df"
]
},
{
"cell_type": "markdown",
"id": "04f361dc-ba92-4071-b031-2837e141efd5",
"metadata": {},
"source": [
"### Nodes are reached slower on the Goerli testnet than on random regular graph - **OK** (Goerli is larger)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f889d77d-6ddf-48d8-82df-56e2f7ea7889",
"metadata": {},
"outputs": [],
"source": [
"visu1 = extract_contact_time_quantiles(passive_random_df)\n",
"visu1[\"graph_model\"] = \"random_regular\"\n",
"visu2 = extract_contact_time_quantiles(passive_goerli_df)\n",
"visu2[\"graph_model\"] = \"goerli_testnet\"\n",
"visu_df = pd.concat([visu1, visu2])"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "565b060c-da0a-4d4f-a1e5-d81f0a0ba6e9",
"metadata": {},
"outputs": [],
"source": [
"fig = px.line(visu_df, x=\"quantile\", y=\"time\", color=\"protocol\", symbol=\"graph_model\")\n",
"fig.show()"
]
},
{
"cell_type": "markdown",
"id": "3614259f-e64f-4780-846e-342eb2102cee",
"metadata": {},
"source": [
"### Nodes are reached slower in case of \"sqrt\" boradcast setting - **OK**"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "71bdf01f-ac9d-42eb-bb6c-66977967a1b9",
"metadata": {},
"outputs": [],
"source": [
"visu1 = extract_contact_time_quantiles(passive_random_bc_all_df)\n",
"visu1[\"broadcast_mode\"] = \"all\"\n",
"visu2 = extract_contact_time_quantiles(passive_random_df)\n",
"visu2[\"broadcast_mode\"] = \"sqrt\"\n",
"visu_df = pd.concat([visu1, visu2])"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1cedb986-b85c-4027-b9dd-907e58e5396f",
"metadata": {},
"outputs": [],
"source": [
"fig = px.line(\n",
" visu_df, x=\"quantile\", y=\"time\", color=\"protocol\", symbol=\"broadcast_mode\"\n",
")\n",
"fig.show()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.15"
},
"notebook_module": {
"alias": "notebook_module",
"code": "",
"compatibility": false
}
},
"nbformat": 4,
"nbformat_minor": 5
}