Skip to content

Commit 1727819

Browse files
committed
feat(icon): added code for generating 4-hypercube graph
1 parent d9276d2 commit 1727819

File tree

3 files changed

+38
-4
lines changed

3 files changed

+38
-4
lines changed

hypercube/generate.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import networkx as nx
2+
import matplotlib.pyplot as plt
3+
4+
5+
G = nx.hypercube_graph(4)
6+
pos = nx.spring_layout(G) # (spring layout works well for hypercubes)
7+
fig, ax = plt.subplots(figsize=(8, 8)) # transparent background
8+
9+
nx.draw(
10+
G, pos, with_labels=False,
11+
node_size=500, node_color="#00FFFF", # Cyan nodes (good contrast in both modes)
12+
edge_color="#333333", # Dark gray edges (works in both modes)
13+
width=4, # Make edges extra bold
14+
ax=ax
15+
)
16+
ax.set_axis_off()
17+
18+
# 4_hypercube_graph_square_bold_edges_contrast
19+
plt.savefig(
20+
"icon.png",
21+
format="png",
22+
transparent=True,
23+
bbox_inches='tight',
24+
pad_inches=0
25+
)
26+
27+
plt.show()

hypercube/requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
matplotlib==3.9.2
2+
networkx==3.3

src/components/About.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,23 @@ const About = () => {
3838
</div>
3939
<p>
4040
For those of you curious, the favicon is a <Highlight text="4-hypercube graph" color="cyan" /> made via Python, using NetworkX and Matplotlib.
41-
Check <LinkWithArrow
41+
Check the <LinkWithArrow
4242
href="/icon.ico" target="_blank"
4343
className="mr-1 hover:underline hover:underline-offset-2 text-orange-500"
4444
>
45-
it
45+
image
4646
</LinkWithArrow>
47-
out and learn <LinkWithArrow
47+
out, learn <LinkWithArrow
4848
href="https://en.wikipedia.org/wiki/Hypercube_graph" target="_blank"
4949
className="mr-1 hover:underline hover:underline-offset-2 text-blue-violet-500"
5050
>
5151
more
52-
</LinkWithArrow>.
52+
</LinkWithArrow> about hypercube graphs & here is the <LinkWithArrow
53+
href="https://github.com/steadyfall/steadyfall.github.io/blob/main/hypercube/generate.py" target="_blank"
54+
className="mr-1 hover:underline hover:underline-offset-2 dark:text-firefly-500 text-firefly-600"
55+
>
56+
code
57+
</LinkWithArrow> to generate it yourself.
5358
</p>
5459
</div>
5560
</BlurFade>

0 commit comments

Comments
 (0)