Skip to content

Commit a6ef216

Browse files
committed
import notebooks from other repo
1 parent cb5abd3 commit a6ef216

10 files changed

+3528
-0
lines changed

notebooks/Core_hours.ipynb

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 1,
6+
"metadata": {},
7+
"outputs": [],
8+
"source": [
9+
"import numpy as np\n",
10+
"import matplotlib as mpl\n",
11+
"%matplotlib inline\n",
12+
"\n",
13+
"import pandas as pd\n",
14+
"\n",
15+
"import json\n",
16+
"import glob\n",
17+
"import os"
18+
]
19+
},
20+
{
21+
"cell_type": "code",
22+
"execution_count": 2,
23+
"metadata": {},
24+
"outputs": [],
25+
"source": [
26+
"data = {}\n",
27+
"\n",
28+
"for path in glob.glob(\"../../data/results/lfr_params_ground_truth/*.json\") + \\\n",
29+
" glob.glob(\"../../data/results/lfr_params/**/*.json\", recursive=True) + \\\n",
30+
" glob.glob(\"../../data/results/all_real/*.json\") + \\\n",
31+
" glob.glob(\"../../data/results/all_real_seq/*.json\") + \\\n",
32+
" glob.glob(\"../../data/results/all_real_seq2/*.json\") + \\\n",
33+
" glob.glob(\"../../data/results/gossip_map/*.json\") + \\\n",
34+
" glob.glob(\"../../data/results/gossip_map2/*.json\") + \\\n",
35+
" glob.glob(\"../../data/results/louvain_baseline/*.json\") + \\\n",
36+
" glob.glob(\"../../data/results/infomap_baseline/*.json\") + \\\n",
37+
" glob.glob(\"../../data/results/weak_scaling/*.json\") + \\\n",
38+
" glob.glob(\"../../data/results/weak_scaling_small_quality/**/*.json\", recursive=True):\n",
39+
" for typename, items in json.load(open(path)).items():\n",
40+
" if typename in data:\n",
41+
" for key, object_data in items.items():\n",
42+
" if key in data[typename]:\n",
43+
" data[typename][key].update(object_data)\n",
44+
" else:\n",
45+
" data[typename][key] = object_data\n",
46+
" else:\n",
47+
" data[typename] = items\n",
48+
"\n",
49+
"frames = { typename: pd.DataFrame.from_dict(items, orient='index') for typename, items in data.items() }"
50+
]
51+
},
52+
{
53+
"cell_type": "code",
54+
"execution_count": 3,
55+
"metadata": {},
56+
"outputs": [],
57+
"source": [
58+
"frames['algorithm_run']['runtime'].fillna((frames['algorithm_run']['done_ts'] - frames['algorithm_run']['start_ts']) / 1000000.0, inplace=True)"
59+
]
60+
},
61+
{
62+
"cell_type": "code",
63+
"execution_count": 4,
64+
"metadata": {},
65+
"outputs": [],
66+
"source": [
67+
"frames['program_run']['hosts'].fillna(1, inplace=True)\n",
68+
"frames['program_run']['workers_per_host'].fillna(1, inplace=True)"
69+
]
70+
},
71+
{
72+
"cell_type": "code",
73+
"execution_count": 9,
74+
"metadata": {},
75+
"outputs": [
76+
{
77+
"data": {
78+
"text/plain": [
79+
"3.5908500805376624"
80+
]
81+
},
82+
"execution_count": 9,
83+
"metadata": {},
84+
"output_type": "execute_result"
85+
}
86+
],
87+
"source": [
88+
"data = frames['algorithm_run'].merge(frames['program_run'], left_on='program_run_id', right_index=True)\n",
89+
"(data['runtime'] * data['hosts'] * data['workers_per_host']).sum() / 60 / 60 / 24 / 365"
90+
]
91+
}
92+
],
93+
"metadata": {
94+
"kernelspec": {
95+
"display_name": "Python 3",
96+
"language": "python",
97+
"name": "python3"
98+
},
99+
"language_info": {
100+
"codemirror_mode": {
101+
"name": "ipython",
102+
"version": 3
103+
},
104+
"file_extension": ".py",
105+
"mimetype": "text/x-python",
106+
"name": "python",
107+
"nbconvert_exporter": "python",
108+
"pygments_lexer": "ipython3",
109+
"version": "3.6.4"
110+
}
111+
},
112+
"nbformat": 4,
113+
"nbformat_minor": 2
114+
}

notebooks/LFRGeneration.ipynb

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"metadata": {},
7+
"outputs": [],
8+
"source": [
9+
"from networkit import *"
10+
]
11+
},
12+
{
13+
"cell_type": "code",
14+
"execution_count": null,
15+
"metadata": {
16+
"collapsed": true
17+
},
18+
"outputs": [],
19+
"source": [
20+
"n = 1000000\n",
21+
"generator = generators.LFRGenerator(n)"
22+
]
23+
},
24+
{
25+
"cell_type": "code",
26+
"execution_count": null,
27+
"metadata": {},
28+
"outputs": [],
29+
"source": [
30+
"for gamma in [-2]:\n",
31+
" for beta in [-1]:\n",
32+
" for mu in [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9]:\n",
33+
" generator.setDegreeSequence(generators.PowerlawDegreeSequence(50, 10000, gamma).run().getDegreeSequence(n))\n",
34+
" #generator.generatePowerlawDegreeSequence(50, 10000, gamma) EEEEEEVIL\n",
35+
" generator.generatePowerlawCommunitySizeSequence(50, 12000, beta)\n",
36+
" generator.setMu(mu)\n",
37+
" generator.run()\n",
38+
" \n",
39+
" community.writeCommunities(generator.getPartition(), \"graph_g{0}_b{1}_m{2}.part\".format(-gamma, -beta, mu))\n",
40+
" graphio.writeGraph(generator.getGraph(), \"graph_g{0}_b{1}_m{2}.graph\".format(-gamma, -beta, mu), Format.METIS)"
41+
]
42+
}
43+
],
44+
"metadata": {
45+
"anaconda-cloud": {},
46+
"kernelspec": {
47+
"display_name": "Python 3",
48+
"language": "python",
49+
"name": "python3"
50+
},
51+
"language_info": {
52+
"codemirror_mode": {
53+
"name": "ipython",
54+
"version": 3
55+
},
56+
"file_extension": ".py",
57+
"mimetype": "text/x-python",
58+
"name": "python",
59+
"nbconvert_exporter": "python",
60+
"pygments_lexer": "ipython3",
61+
"version": "3.6.4"
62+
}
63+
},
64+
"nbformat": 4,
65+
"nbformat_minor": 2
66+
}

notebooks/Paper - Quality.ipynb

Lines changed: 244 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)