Skip to content

Commit e675c03

Browse files
committed
add: updated resoltuion parameter
1 parent e5eaa80 commit e675c03

File tree

3 files changed

+11994
-33
lines changed

3 files changed

+11994
-33
lines changed

doc/source/community_detection_guide.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ This documentation provides an overview of the notebooks available in the commun
1313
community_detection_guide/notebooks/generating_and_visualizing_clusters.ipynb
1414
community_detection_guide/notebooks/hierarchical_clustering.ipynb
1515
community_detection_guide/notebooks/modularity.ipynb
16-
community_detection_guide/notebooks/interactive_resolution_on_sierpinski.ipynb
16+
community_detection_guide/notebooks/resolution.ipynb
1717
community_detection_guide/notebooks/consensus_clustering.ipynb
1818
community_detection_guide/notebooks/membership_vector.ipynb
1919
community_detection_guide/notebooks/working_with_clusterings.ipynb
@@ -130,8 +130,8 @@ This documentation provides an overview of the notebooks available in the commun
130130
</a>
131131
</div>
132132

133-
.. grid-item-card:: Interactive Resolution on Sierpinski
134-
:link: community_detection_guide/notebooks/interactive_resolution_on_sierpinski
133+
.. grid-item-card:: Resolution Parameter
134+
:link: community_detection_guide/notebooks/resolution
135135
:link-type: doc
136136
:class-card: sd-card-hover card-deep-blue
137137
:shadow: sm
@@ -141,7 +141,7 @@ This documentation provides an overview of the notebooks available in the commun
141141
.. raw:: html
142142

143143
<div class="download-container">
144-
<a href="community_detection_guide/notebooks/interactive_resolution_on_sierpinski.ipynb" download>
144+
<a href="community_detection_guide/notebooks/resolution.ipynb" download>
145145
<button type="button" class="download-button">
146146
<i class="fa-solid fa-download"></i> Download Notebook
147147
</button>

doc/source/community_detection_guide/notebooks/functions.ipynb

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -519,9 +519,10 @@
519519
"metadata": {},
520520
"outputs": [],
521521
"source": [
522-
"def get_sierpinski_graph_and_layout(depth):\n",
522+
"def sierpinski_graph(depth):\n",
523523
" \"\"\"\n",
524-
" Generates a Sierpiński triangle graph with unique vertices and its coordinate layout.\n",
524+
" Generates a Sierpiński triangle graph along with its vertex coordinates\n",
525+
" in the x and y vertex attributes.\n",
525526
" \"\"\"\n",
526527
" import igraph as ig\n",
527528
" import numpy as np\n",
@@ -539,7 +540,7 @@
539540
" coord_tuple = tuple(coord)\n",
540541
" if coord_tuple not in coord_to_id:\n",
541542
" coord_to_id[coord_tuple] = next_id\n",
542-
" G.add_vertex(coords=coord_tuple)\n",
543+
" G.add_vertex(x=coord[0], y=coord[1])\n",
543544
" next_id += 1\n",
544545
" return coord_to_id[coord_tuple]\n",
545546
" \n",
@@ -564,32 +565,7 @@
564565
" p1, p2, p3 = (0, 0), (1, 0), (0.5, np.sqrt(3)/2)\n",
565566
" add_triangle(G, p1, p2, p3, depth)\n",
566567
"\n",
567-
" layout = [v['coords'] for v in G.vs]\n",
568-
" return G, layout\n",
569-
"\n",
570-
"def draw_sierpinski_igraph_on_axes(depth, ax):\n",
571-
" \"\"\"\n",
572-
" Generates and draws a Sierpiński triangle using igraph onto a given Matplotlib Axes.\n",
573-
" \"\"\"\n",
574-
" G, layout = get_sierpinski_graph_and_layout(depth)\n",
575-
" ax.clear()\n",
576-
" \n",
577-
" if not G.vcount():\n",
578-
" ax.set_title(f\"Sierpiński Triangle - Depth {depth} (No vertices)\")\n",
579-
" ax.set_xticks([])\n",
580-
" ax.set_yticks([])\n",
581-
" ax.axis('off')\n",
582-
" return\n",
583-
"\n",
584-
" ig.plot(G, target=ax, layout=layout, vertex_size=5, vertex_color=\"black\", \n",
585-
" vertex_label=None, edge_color=\"blue\", edge_width=1,\n",
586-
" bbox=(0, 0, 600, 600), margin=20)\n",
587-
" \n",
588-
" ax.set_title(f\"Sierpiński Triangle - Depth {depth}\")\n",
589-
" ax.set_aspect('equal', adjustable='box')\n",
590-
" ax.set_xticks([])\n",
591-
" ax.set_yticks([])\n",
592-
" ax.axis('off')"
568+
" return G"
593569
]
594570
}
595571
],

doc/source/community_detection_guide/notebooks/resolution.ipynb

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

0 commit comments

Comments
 (0)