Skip to content

Commit

Permalink
Attempt at integrating the tutorials in API (#457)
Browse files Browse the repository at this point in the history
* first attempt

* add nbsphinx in the requirements

* attempt: movimg tutorials in docs/api

* adding 5 and 15 minutes

* update test.yml with new location of the tutorials

* fix: wrong path in previous commit

* minor fix

* Attempt: Tutorials in outside docs folder with nbsphinx-link

*moved tutos to original position

* minor fix

* attempt: fix wrong path in previous commit

* attempt at fix: tutorial not showing in the api

* attempt: maybe the issue is the spaces

* Revert "minor fix"

This reverts commit 295c4bf.

* Revert "Revert "minor fix""

This reverts commit a3b7ba4.

* Revert "attempt: maybe the issue is the spaces"

This reverts commit 84c6b11.

* Revert "attempt at fix: tutorial not showing in the api"

This reverts commit f4a416b.

* Revert "attempt: fix wrong path in previous commit"

This reverts commit 3f4e9e2.

* Revert "minor fix"

This reverts commit ec09cce.

* Revert "Attempt: Tutorials in outside docs folder with nbsphinx-link"

This reverts commit 49b2c7c.

* adding more tutorials in the API

* feat: included recipes from #451 #463 #464

* add recipes in API

* attempt at fixing

* attempt at fix

* Adding title to recipes.rst

* Tutorials and recipes in same toctree

* style: uniform titles for tutos

* minor changes

* attempt at changing the depth of toctrees

* minor fix : markdown hierarchy in plotting tuto

* minor changes

* links: XGI in 15 mins

* links: XGI in 5 mins

* links: XGI in 1 min

* added missing descriptions in recipes

* change toctree structure in tutorials.rst

* second attempt toc structure

* attempt for nested toc structure

* minor fix

* add recipe for multilayer draw

* minor fix

* - to .
  • Loading branch information
thomasrobiglio authored Oct 16, 2023
1 parent 5248e4b commit 1b8df54
Show file tree
Hide file tree
Showing 33 changed files with 2,925 additions and 2,009 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Prepare tutorial notebooks
run: |
# go into tutorial location
cd tutorials/
cd docs/source/api/tutorials/
# convert each notebook into a python file
jupyter nbconvert --to script *.ipynb
# rename the files so they are found by pytest: add 'test' at the beginning
Expand All @@ -48,7 +48,7 @@ jobs:
- name: Test tutorial notebooks
run: |
# run pytest ONLY on the tutorials
cd tutorials/
cd docs/source/api/tutorials/
pytest --color=yes
pytest:
Expand Down
8 changes: 8 additions & 0 deletions docs/source/api/recipes.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
##################
Recipes
##################

.. toctree::
:maxdepth: 1

recipes/recipes
642 changes: 642 additions & 0 deletions docs/source/api/recipes/recipes.ipynb

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions docs/source/api/tutorials.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
##################
Tutorials
##################

.. toctree::
:maxdepth: 2

tutorials/getting_started
tutorials/focus_tutorials
tutorials/in_depth
tutorials/case_studies

File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"# Tutorial 1 - Loading hypergraphs and basic functionality"
"# Basic hypergraph functionality"
]
},
{
Expand All @@ -16,7 +17,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 13,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -42,7 +43,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -82,7 +83,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 15,
"metadata": {},
"outputs": [
{
Expand All @@ -109,7 +110,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 16,
"metadata": {},
"outputs": [
{
Expand All @@ -136,7 +137,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 17,
"metadata": {},
"outputs": [
{
Expand All @@ -162,14 +163,14 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 18,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"The hypergraph has 12368 nodes and 2261 edges\n"
"The hypergraph has 143 nodes and 10885 edges\n"
]
}
],
Expand Down Expand Up @@ -200,7 +201,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 19,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -221,7 +222,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 20,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -237,7 +238,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 21,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -257,7 +258,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 22,
"metadata": {},
"outputs": [
{
Expand All @@ -266,8 +267,8 @@
"text": [
"H is not connected\n",
"The sizes of the connected components are:\n",
"[484, 3, 3, 3, 2, 4, 4]\n",
"The size of the component containing node 881 is 484\n"
"[438, 4, 3, 3, 3, 3, 2, 4, 4, 4]\n",
"The size of the component containing node 713 is 438\n"
]
}
],
Expand Down Expand Up @@ -298,7 +299,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 23,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -323,7 +324,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 24,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -359,7 +360,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.6"
"version": "3.9.13"
},
"toc": {
"base_numbering": 1,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,38 @@
{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## Importing and exporting hypergraph data\n",
"\n",
"When working with empirical hypergraph data, the following file formats representing hypergraphs are commonly seen in practice:\n",
"* A hyperedge list, where each line represents a hyperedge\n",
"* A bipartite edge list where each line contains two entries: a node ID and an edge ID\n",
"* An incidence matrix\n",
"\n",
"The `readwrite` module provides functionality to import and export these file formats."
"# Read and Write"
]
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import xgi\n",
"import random"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## Importing and exporting hypergraph data\n",
"\n",
"When working with empirical hypergraph data, the following file formats representing hypergraphs are commonly seen in practice:\n",
"* A hyperedge list, where each line represents a hyperedge\n",
"* A bipartite edge list where each line contains two entries: a node ID and an edge ID\n",
"* An incidence matrix\n",
"\n",
"The `readwrite` module provides functionality to import and export these file formats."
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand All @@ -33,7 +42,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -62,7 +71,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -83,7 +92,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -104,7 +113,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -133,7 +142,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.4"
"version": "3.9.13"
},
"orig_nbformat": 4,
"vscode": {
Expand Down
Loading

0 comments on commit 1b8df54

Please sign in to comment.