Skip to content

Commit de027f3

Browse files
trying netlify hosted docs
1 parent cbde79f commit de027f3

File tree

7 files changed

+119
-5
lines changed

7 files changed

+119
-5
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
!mkdocs.yml
1616
!generate_graph_examples.py
1717
!.python-version
18+
!requirements.txt
19+
!netlify.toml
1820

1921
# recursively re-ignore
2022
__pycache__

docs/examples/basic.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Let's create a 5-node cycle graph and add some basic styling through node attrib
88

99
<div class="interactive-graph-wrapper" style="margin-bottom: 1.5em; padding: 1em; border: 1px solid #e0e0e0; border-radius: 4px; background-color: #f9f9f9;">
1010
<h4 style="margin-top: 0; margin-bottom: 0.5em; font-size: 1.1em;">Interactive 5-Cycle Graph</h4>
11-
<iframe src="/nx-vis-visualizer/assets/generated_graphs/cycle_graph_example.html"
11+
<iframe src="/assets/generated_graphs/cycle_graph_example.html"
1212
width="100%"
1313
height="450px"
1414
style="border: 1px solid #ccc; max-width: 100%; display: block;"
@@ -57,7 +57,7 @@ The `vis_options` used (as a Python dictionary in the generation script):
5757

5858
<div class="interactive-graph-wrapper" style="margin-bottom: 1.5em; padding: 1em; border: 1px solid #e0e0e0; border-radius: 4px; background-color: #f9f9f9;">
5959
<h4 style="margin-top: 0; margin-bottom: 0.5em; font-size: 1.1em;">Zachary's Karate Club</h4>
60-
<iframe src="/nx-vis-visualizer/assets/generated_graphs/karate_club_example.html"
60+
<iframe src="/assets/generated_graphs/karate_club_example.html"
6161
width="100%"
6262
height="550px"
6363
style="border: 1px solid #ccc; max-width: 100%; display: block;"

docs/examples/customization.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Advanced Customization Showcase
2+
3+
This page demonstrates a graph with a wide variety of node and edge customizations, physics settings, and interaction options available through `vis_options`.
4+
5+
The graph includes:
6+
- Nodes with different shapes, colors, sizes, and groups.
7+
- Fixed position nodes.
8+
- Nodes with multi-font labels.
9+
- Edges with different colors, widths, dashing, and labels.
10+
- Edges with explicit arrowheads.
11+
- Edges with complex color objects (including hover and opacity).
12+
- Node and edge size scaling based on attributes (`value` and `weight`).
13+
- Group-based styling.
14+
- An interactive configuration panel (usually appears at the bottom or can be toggled) to tweak Vis.js settings live.
15+
16+
<div class="interactive-graph-wrapper" style="margin-bottom: 1.5em; padding: 1em; border: 1px solid #e0e0e0; border-radius: 4px; background-color: #f9f9f9;">
17+
<h4 style="margin-top: 0; margin-bottom: 0.5em; font-size: 1.1em;">Advanced Customization Example</h4>
18+
<iframe src="/nx-vis-visualizer/assets/generated_graphs/advanced_showcase_example.html"
19+
width="100%"
20+
height="700px"
21+
style="border: 1px solid #ccc; max-width: 100%; display: block;"
22+
sandbox="allow-scripts allow-same-origin allow-popups allow-forms">
23+
Your browser does not support iframes. Please update your browser.
24+
</iframe>
25+
</div>
26+
27+
The Python code to generate the graph structure can be found in `examples/advanced_showcase.py`. Here's a snippet of how nodes and edges are defined:
28+
29+
```python
30+
# From examples/advanced_showcase.py (snippet)
31+
import networkx as nx
32+
import random
33+
34+
def create_showcase_graph():
35+
G = nx.Graph(name="Advanced Showcase Graph")
36+
37+
# Special, styled nodes
38+
G.add_node(
39+
"Source",
40+
label="START",
41+
shape="diamond",
42+
color={"background": "lightgreen", "border": "darkgreen"},
43+
size=30,
44+
fixed={"x": True, "y": True}, x=-400, y=-200,
45+
# ... other attributes
46+
)
47+
# ... more nodes ...
48+
49+
G.add_edge(
50+
"Hub", "Sink", weight=5, color="blue", width=4,
51+
title="Main link from Hub to Sink", arrows="to",
52+
smooth={"type": "curvedCW", "roundness": 0.2}
53+
)
54+
# ... more edges ...
55+
return G
56+
```
57+
58+
The extensive `vis_options` used for this graph (defined as `custom_vis_options` in `examples/advanced_showcase.py`):
59+
```json
60+
// From examples/advanced_showcase.py (snippet of custom_vis_options)
61+
{
62+
"nodes": {
63+
"borderWidth": 2,
64+
"scaling": {
65+
"min": 10,
66+
"max": 30,
67+
"label": {"enabled": True, "min": 8, "max": 20}
68+
},
69+
"shadow": {"enabled": True, "size": 5, "x": 3, "y": 3}
70+
},
71+
"edges": {
72+
"width": 1,
73+
"color": {
74+
"inherit": "from",
75+
"opacity": 1.0
76+
},
77+
"arrows": {
78+
"to": {"enabled": False, "scaleFactor": 0.8, "type": "arrow"}
79+
},
80+
"smooth": {"enabled": True, "type": "dynamic", "roundness": 0.5},
81+
"scaling": {"min": 1, "max": 8}
82+
},
83+
"groups": { /* ... group definitions ... */ },
84+
"interaction": {
85+
"navigationButtons": True,
86+
"keyboard": {"enabled": True}
87+
},
88+
"physics": {
89+
"enabled": True,
90+
"solver": "barnesHut",
91+
"stabilization": {"enabled": True, "iterations": 1000, "fit": True}
92+
},
93+
"configure": {"enabled": True, "showButton": False }
94+
}
95+
```
96+
*Note: The configuration panel is enabled for this graph, allowing live tweaking of options.*

docs/examples/directed.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This example shows a basic directed graph where edge directions are indicated by
88

99
<div class="interactive-graph-wrapper" style="margin-bottom: 1.5em; padding: 1em; border: 1px solid #e0e0e0; border-radius: 4px; background-color: #f9f9f9;">
1010
<h4 style="margin-top: 0; margin-bottom: 0.5em; font-size: 1.1em;">Simple Directed Graph</h4>
11-
<iframe src="/nx-vis-visualizer/assets/generated_graphs/simple_directed_example.html"
11+
<iframe src="/assets/generated_graphs/simple_directed_example.html"
1212
width="100%"
1313
height="500px"
1414
style="border: 1px solid #ccc; max-width: 100%; display: block;"
@@ -71,7 +71,7 @@ This example demonstrates a directed graph representing course prerequisites, us
7171

7272
<div class="interactive-graph-wrapper" style="margin-bottom: 1.5em; padding: 1em; border: 1px solid #e0e0e0; border-radius: 4px; background-color: #f9f9f9;">
7373
<h4 style="margin-top: 0; margin-bottom: 0.5em; font-size: 1.1em;">Course Prerequisites</h4>
74-
<iframe src="/nx-vis-visualizer/assets/generated_graphs/course_prerequisites_example.html"
74+
<iframe src="/assets/generated_graphs/course_prerequisites_example.html"
7575
width="100%"
7676
height="600px"
7777
style="border: 1px solid #ccc; max-width: 100%; display: block;"

mkdocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# mkdocs.yml
22
site_name: NX-VIS Visualizer
3-
site_url: https://particularlypythonicsbs.github.io/nx-vis-visualizer/
3+
site_url: https://nx-vis-visualizer.netlify.app/
44
site_author: Anil Radhakrishnan
55
repo_url: https://github.com/ParticularlyPythonicBS/nx-vis-visualizer
66
repo_name: ParticularlyPythonicBS/nx-vis-visualizer

netlify.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# netlify.toml
2+
3+
[build]
4+
publish = "site"
5+
# The command Netlify will run.
6+
# Netlify's build image should handle activating the specified PYTHON_VERSION
7+
# and making 'python' and 'pip' available on the PATH from that version.
8+
command = "pip install -r requirements.txt && pip install . && python generate_graph_examples.py && mkdocs build"
9+
10+
[build.environment]
11+
PYTHON_VERSION = "3.12" # Be explicit. You can try "3.12.10" if "3.12" is ambiguous
12+
# or another version like "3.11" if 3.12 is problematic on Netlify.

requirements.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# requirements.txt
2+
mkdocs>=1.5
3+
mkdocs-material>=9.0
4+
networkx>=3.0

0 commit comments

Comments
 (0)