Update app.py
Browse files
app.py
CHANGED
|
@@ -36,7 +36,8 @@ def display_spectral_embedding():
|
|
| 36 |
|
| 37 |
fig, axs = plt.subplots(3, 3, figsize=(12, 12))
|
| 38 |
axs = axs.flatten()
|
| 39 |
-
|
|
|
|
| 40 |
if i == 0:
|
| 41 |
nx.draw_spectral(G, **options, ax=axs[i])
|
| 42 |
elif i == 1:
|
|
@@ -58,6 +59,10 @@ def display_spectral_embedding():
|
|
| 58 |
G.remove_edge((4, 2), (4, 3))
|
| 59 |
nx.draw_spectral(G, **options, ax=axs[i])
|
| 60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
st.pyplot(fig)
|
| 62 |
|
| 63 |
elif option == "Create your own":
|
|
@@ -76,7 +81,7 @@ def display_spectral_embedding():
|
|
| 76 |
axs = axs.flatten()
|
| 77 |
|
| 78 |
# Loop through each subplot and allow edge removal individually
|
| 79 |
-
for i in range(7):
|
| 80 |
selected_edges = st.multiselect(f"Select edges to remove for graph {i+1}:",
|
| 81 |
options=[str(edge) for edge in all_edges])
|
| 82 |
|
|
@@ -90,6 +95,10 @@ def display_spectral_embedding():
|
|
| 90 |
# Draw the graph with removed edges
|
| 91 |
nx.draw_spectral(G_custom_copy, **{"node_color": "C0", "node_size": 100}, ax=axs[i])
|
| 92 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
st.pyplot(fig)
|
| 94 |
|
| 95 |
# Display Drawing: Spectral Embedding if selected
|
|
|
|
| 36 |
|
| 37 |
fig, axs = plt.subplots(3, 3, figsize=(12, 12))
|
| 38 |
axs = axs.flatten()
|
| 39 |
+
|
| 40 |
+
for i in range(7): # Looping over 7 images
|
| 41 |
if i == 0:
|
| 42 |
nx.draw_spectral(G, **options, ax=axs[i])
|
| 43 |
elif i == 1:
|
|
|
|
| 59 |
G.remove_edge((4, 2), (4, 3))
|
| 60 |
nx.draw_spectral(G, **options, ax=axs[i])
|
| 61 |
|
| 62 |
+
# Hide the last two subplots (8th and 9th)
|
| 63 |
+
for j in range(7, 9):
|
| 64 |
+
fig.delaxes(axs[j]) # Delete the extra axes
|
| 65 |
+
|
| 66 |
st.pyplot(fig)
|
| 67 |
|
| 68 |
elif option == "Create your own":
|
|
|
|
| 81 |
axs = axs.flatten()
|
| 82 |
|
| 83 |
# Loop through each subplot and allow edge removal individually
|
| 84 |
+
for i in range(7): # Looping over 7 images
|
| 85 |
selected_edges = st.multiselect(f"Select edges to remove for graph {i+1}:",
|
| 86 |
options=[str(edge) for edge in all_edges])
|
| 87 |
|
|
|
|
| 95 |
# Draw the graph with removed edges
|
| 96 |
nx.draw_spectral(G_custom_copy, **{"node_color": "C0", "node_size": 100}, ax=axs[i])
|
| 97 |
|
| 98 |
+
# Hide the last two subplots (8th and 9th)
|
| 99 |
+
for j in range(7, 9):
|
| 100 |
+
fig.delaxes(axs[j]) # Delete the extra axes
|
| 101 |
+
|
| 102 |
st.pyplot(fig)
|
| 103 |
|
| 104 |
# Display Drawing: Spectral Embedding if selected
|