Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: creating Pyvis network graph #2418

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 53 additions & 48 deletions Pyvis/Pyvis_Create_a_network_visualization.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"tags": []
},
"source": [
"**Tags:** #python #naas #scheduler #network #snippet #analytics"
"**Tags:** #python #naas #asset #network #analytics"
]
},
{
Expand All @@ -60,7 +60,7 @@
"tags": []
},
"source": [
"**Last update:** 2023-04-12 (Created: 2022-07-27)"
"**Last update:** 2023-12-01 (Created: 2022-07-27)"
]
},
{
Expand All @@ -82,7 +82,8 @@
"tags": []
},
"source": [
"**References:** https://pyvis.readthedocs.io/en/latest/tutorial.html"
"**References:** \n",
"- [Pyvis documentation](https://pyvis.readthedocs.io/en/latest/tutorial.html)"
]
},
{
Expand All @@ -98,83 +99,98 @@
},
{
"cell_type": "markdown",
"id": "87f5d344-ecdd-4054-8696-34ed7f96548c",
"id": "numeric-mediterranean",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"### Import packages"
"### Import libraries"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "6b708479-188a-41ca-9180-46b6328b6621",
"execution_count": null,
"id": "potential-surfing",
"metadata": {
"jupyter": {
"source_hidden": true
},
"papermill": {},
"tags": []
},
"outputs": [],
"source": [
"pip install pyvis"
"import naas\n",
"try:\n",
" from pyvis.network import Network\n",
"except:\n",
" !pip install pyvis --upgrade\n",
" from pyvis.network import Network"
]
},
{
"cell_type": "markdown",
"id": "numeric-mediterranean",
"id": "aggressive-trustee",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"### Import library"
"### Setup variables\n",
"- `network_name`: Network name\n",
"- `height`: Network height\n",
"- `width`: Network width\n",
"- `bgcolor`: Network background color\n",
"- `font_color`: Network font color"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "potential-surfing",
"execution_count": null,
"id": "continuous-melbourne",
"metadata": {
"jupyter": {
"source_hidden": true
},
"papermill": {},
"tags": []
},
"outputs": [],
"source": [
"import naas\n",
"from pyvis.network import Network"
"network_name = \"pyvis_example\"\n",
"height = \"750px\"\n",
"width = \"100%\"\n",
"bgcolor = \"#222222\"\n",
"font_color = \"white\""
]
},
{
"cell_type": "markdown",
"id": "aggressive-trustee",
"id": "registered-showcase",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"### Setup the global variables for the network"
"## Model"
]
},
{
"cell_type": "markdown",
"id": "ed90822e-8456-47c8-937a-7d207d96993d",
"metadata": {},
"source": [
"### Initializing the Pyvis network"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "continuous-melbourne",
"metadata": {
"papermill": {},
"tags": []
},
"execution_count": null,
"id": "14656059-6704-41fb-b8c4-315881efca42",
"metadata": {},
"outputs": [],
"source": [
"network_name = \"pyvis_example\"\n",
"net = Network(\n",
" notebook=True, height=\"750px\", width=\"100%\", bgcolor=\"#222222\", font_color=\"white\"\n",
" notebook=True,\n",
" height=height,\n",
" width=width,\n",
" bgcolor=bgcolor,\n",
" font_color=font_color\n",
")"
]
},
Expand All @@ -191,7 +207,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"id": "c11aae54-33b4-4f21-889a-988ddf28a079",
"metadata": {
"papermill": {},
Expand Down Expand Up @@ -232,7 +248,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"id": "ede1c7f7-cd29-49e2-be8a-db9484848959",
"metadata": {
"papermill": {},
Expand Down Expand Up @@ -271,17 +287,6 @@
")"
]
},
{
"cell_type": "markdown",
"id": "registered-showcase",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"## Model"
]
},
{
"cell_type": "markdown",
"id": "tested-astrology",
Expand All @@ -295,7 +300,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": null,
"id": "crude-louisville",
"metadata": {
"papermill": {},
Expand All @@ -319,7 +324,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": null,
"id": "9cca845f-3a67-4e5f-9721-903970bee206",
"metadata": {
"papermill": {},
Expand Down Expand Up @@ -388,7 +393,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": null,
"id": "9c4e3b7b-6440-4844-8054-265f1aec65eb",
"metadata": {
"papermill": {},
Expand All @@ -413,7 +418,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": null,
"id": "db205965-a2dc-4541-ba8e-db3250d1cff0",
"metadata": {
"papermill": {},
Expand Down Expand Up @@ -466,4 +471,4 @@
},
"nbformat": 4,
"nbformat_minor": 5
}
}
Loading
Loading