Skip to content

Commit 22b0e2d

Browse files
committed
Upgrade directives with nbdev_migrate
Additionally, 03_example_graphs.ipynb had to be modified to not to loose information, as originally the page description spanned two lines (and nbdev_migrate lost the contents of the second line). Also, _Reachability_labels_for_version_control_graphs.ipynb and _Reachability_queries_in_large_graphs.ipynb were kept as is. Those files serve as original source to be put in nbdev-managed notebooks.
1 parent 52815e8 commit 22b0e2d

14 files changed

+314
-197
lines changed

01_tools.ipynb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
{
22
"cells": [
33
{
4-
"cell_type": "markdown",
4+
"cell_type": "raw",
55
"metadata": {},
66
"source": [
7-
"# Graphs in Python"
7+
"---\n",
8+
"output-file: tools.html\n",
9+
"title: Graphs in Python\n",
10+
"\n",
11+
"---\n",
12+
"\n"
813
]
914
},
1015
{

02_related.ipynb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
{
22
"cells": [
33
{
4-
"cell_type": "markdown",
4+
"cell_type": "raw",
55
"metadata": {},
66
"source": [
7-
"# Related works: various reachability labelings"
7+
"---\n",
8+
"output-file: related.html\n",
9+
"title: 'Related works: various reachability labelings'\n",
10+
"\n",
11+
"---\n",
12+
"\n"
813
]
914
},
1015
{

03_example_graphs.ipynb

Lines changed: 34 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
{
22
"cells": [
33
{
4-
"cell_type": "code",
5-
"execution_count": null,
4+
"cell_type": "raw",
65
"metadata": {},
7-
"outputs": [],
86
"source": [
9-
"#default_exp example_graphs"
7+
"---\n",
8+
"description: Various functions to generate examples of directed graphs (DAGs), mainly graphs from various [related works](02_related.ipynb)\n",
9+
"output-file: example_graphs.html\n",
10+
"title: Example directed graphs\n",
11+
"---"
1012
]
1113
},
1214
{
@@ -15,18 +17,17 @@
1517
"metadata": {},
1618
"outputs": [],
1719
"source": [
18-
"%load_ext autoreload\n",
19-
"%autoreload 2"
20+
"#| default_exp example_graphs"
2021
]
2122
},
2223
{
23-
"cell_type": "markdown",
24+
"cell_type": "code",
25+
"execution_count": null,
2426
"metadata": {},
27+
"outputs": [],
2528
"source": [
26-
"# Example directed graphs\n",
27-
"\n",
28-
"> Various functions to generate examples of directed graphs (DAGs),\n",
29-
"> mainly graphs from various [related works](02_related.ipynb)"
29+
"%load_ext autoreload\n",
30+
"%autoreload 2"
3031
]
3132
},
3233
{
@@ -35,7 +36,7 @@
3536
"metadata": {},
3637
"outputs": [],
3738
"source": [
38-
"#hide\n",
39+
"#| include: false\n",
3940
"from nbdev.showdoc import *"
4041
]
4142
},
@@ -45,7 +46,7 @@
4546
"metadata": {},
4647
"outputs": [],
4748
"source": [
48-
"#export\n",
49+
"#| export\n",
4950
"import networkx as nx"
5051
]
5152
},
@@ -85,7 +86,7 @@
8586
"metadata": {},
8687
"outputs": [],
8788
"source": [
88-
"#export\n",
89+
"#| export\n",
8990
"def crown_DAG():\n",
9091
" \"\"\"Returns crown DAG known as S_3^0 graph\n",
9192
"\n",
@@ -289,7 +290,7 @@
289290
"metadata": {},
290291
"outputs": [],
291292
"source": [
292-
"#export\n",
293+
"#| export\n",
293294
"def small_DAG_FELINE():\n",
294295
" \"\"\"Create small DAG (example in Figure 2 in FELINE paper)\n",
295296
"\n",
@@ -490,7 +491,7 @@
490491
"metadata": {},
491492
"outputs": [],
492493
"source": [
493-
"#export\n",
494+
"#| export\n",
494495
"def tree_DAG():\n",
495496
" \"\"\"Create tree DAG ('didactic example' in Figure 6 in FELINE paper)\n",
496497
"\n",
@@ -717,7 +718,7 @@
717718
"metadata": {},
718719
"outputs": [],
719720
"source": [
720-
"#export\n",
721+
"#| export\n",
721722
"def levels_DAG_FELINE():\n",
722723
" \"\"\"Create graph from Figure 9 in FELINE paper, used to show levels-filter\n",
723724
"\n",
@@ -1024,7 +1025,7 @@
10241025
"metadata": {},
10251026
"outputs": [],
10261027
"source": [
1027-
"#export\n",
1028+
"#| export\n",
10281029
"def RCH_graph():\n",
10291030
" \"\"\"Create RCH example graph (example in Figure 1 and 2 in PReaCH paper)\n",
10301031
"\n",
@@ -1195,7 +1196,7 @@
11951196
"metadata": {},
11961197
"outputs": [],
11971198
"source": [
1198-
"#export\n",
1199+
"#| export\n",
11991200
"def commit_graph_Stolee():\n",
12001201
" \"\"\"Create an example of Git commit graph\n",
12011202
"\n",
@@ -1397,7 +1398,7 @@
13971398
}
13981399
],
13991400
"source": [
1400-
"#hide\n",
1401+
"#| include: false\n",
14011402
"# this should be the last cell of the notebook\n",
14021403
"from nbdev.export import notebook2script\n",
14031404
"notebook2script()"
@@ -1406,9 +1407,21 @@
14061407
],
14071408
"metadata": {
14081409
"kernelspec": {
1409-
"display_name": "Python 3",
1410+
"display_name": "Python 3 (ipykernel)",
14101411
"language": "python",
14111412
"name": "python3"
1413+
},
1414+
"language_info": {
1415+
"codemirror_mode": {
1416+
"name": "ipython",
1417+
"version": 3
1418+
},
1419+
"file_extension": ".py",
1420+
"mimetype": "text/x-python",
1421+
"name": "python",
1422+
"nbconvert_exporter": "python",
1423+
"pygments_lexer": "ipython3",
1424+
"version": "3.8.5"
14121425
}
14131426
},
14141427
"nbformat": 4,

05_reachability_index.ipynb

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
{
22
"cells": [
33
{
4-
"cell_type": "markdown",
4+
"cell_type": "raw",
55
"metadata": {},
66
"source": [
7-
"# Reachability index\n",
8-
"> Describe different types of reachability indices (labels), define negative-cut and positive-cut filters"
7+
"---\n",
8+
"description: Describe different types of reachability indices (labels), define negative-cut\n",
9+
" and positive-cut filters\n",
10+
"output-file: reachability_index.html\n",
11+
"title: Reachability index\n",
12+
"\n",
13+
"---\n",
14+
"\n"
915
]
1016
},
1117
{

06_levels.ipynb

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "raw",
5+
"metadata": {},
6+
"source": [
7+
"---\n",
8+
"description: Defining topological levels, and describing their characteristics\n",
9+
"output-file: levels.html\n",
10+
"title: Topological levels\n",
11+
"\n",
12+
"---\n",
13+
"\n"
14+
]
15+
},
316
{
417
"cell_type": "code",
518
"execution_count": null,
619
"metadata": {},
720
"outputs": [],
821
"source": [
9-
"#default_exp labelling.levels"
22+
"#| default_exp labelling.levels"
1023
]
1124
},
1225
{
@@ -28,14 +41,6 @@
2841
"%autoreload 2"
2942
]
3043
},
31-
{
32-
"cell_type": "markdown",
33-
"metadata": {},
34-
"source": [
35-
"# Topological levels\n",
36-
"> Defining topological levels, and describing their characteristics"
37-
]
38-
},
3944
{
4045
"cell_type": "markdown",
4146
"metadata": {},
@@ -57,7 +62,11 @@
5762
"\n",
5863
"The backward topological level increases at least by one when going in the opposite direction to edges (going backwards).\n",
5964
"\n",
60-
"> Note: This reachability label is _immutable_ with respect to the graph growth by adding nodes."
65+
":::{.callout-note}\n",
66+
"\n",
67+
"This reachability label is _immutable_ with respect to the graph growth by adding nodes.\n",
68+
"\n",
69+
":::"
6170
]
6271
},
6372
{
@@ -109,7 +118,11 @@
109118
"cell_type": "markdown",
110119
"metadata": {},
111120
"source": [
112-
"> Note: the alternative notation for $l_u$ is $l(u)$, and for $L_u$ is $L(u)$.\n",
121+
":::{.callout-note}\n",
122+
"\n",
123+
"the alternative notation for $l_u$ is $l(u)$, and for $L_u$ is $L(u)$.\n",
124+
"\n",
125+
":::\n",
113126
"\n",
114127
"In other words the following observation holds:\n",
115128
"\n",
@@ -155,8 +168,8 @@
155168
"metadata": {},
156169
"outputs": [],
157170
"source": [
158-
"#export\n",
159-
"import networkx as nx\n"
171+
"#| export\n",
172+
"import networkx as nx"
160173
]
161174
},
162175
{
@@ -172,7 +185,7 @@
172185
"metadata": {},
173186
"outputs": [],
174187
"source": [
175-
"#export\n",
188+
"#| export\n",
176189
"def find_levels(DG, attr=None):\n",
177190
" \"\"\"Find levels (generation number) of all vertices in graph G\n",
178191
" \n",
@@ -231,7 +244,7 @@
231244
" for node, level in lvl.items():\n",
232245
" DG.nodes[node][attr] = level\n",
233246
" \n",
234-
" return lvl\n"
247+
" return lvl"
235248
]
236249
},
237250
{
@@ -422,7 +435,7 @@
422435
}
423436
],
424437
"source": [
425-
"#hide\n",
438+
"#| include: false\n",
426439
"# this should be the last cell of the notebook\n",
427440
"from nbdev.export import notebook2script\n",
428441
"notebook2script()"

0 commit comments

Comments
 (0)