Update app.py
Browse files
app.py
CHANGED
|
@@ -73,7 +73,14 @@ def display_spectral_embedding():
|
|
| 73 |
# List all edges to allow removal
|
| 74 |
all_edges = list(G_custom.edges())
|
| 75 |
|
| 76 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
generate_button = st.button("Generate Graph")
|
| 78 |
|
| 79 |
if generate_button:
|
|
@@ -81,12 +88,8 @@ def display_spectral_embedding():
|
|
| 81 |
axs = axs.flatten()
|
| 82 |
|
| 83 |
# Loop through each subplot and allow edge removal individually
|
| 84 |
-
for i in range(7): #
|
| 85 |
-
|
| 86 |
-
options=[str(edge) for edge in all_edges])
|
| 87 |
-
|
| 88 |
-
# Convert the selected edges from string to tuple
|
| 89 |
-
edges_to_remove = [tuple(eval(edge)) for edge in selected_edges]
|
| 90 |
|
| 91 |
# Remove the selected edges
|
| 92 |
G_custom_copy = G_custom.copy()
|
|
|
|
| 73 |
# List all edges to allow removal
|
| 74 |
all_edges = list(G_custom.edges())
|
| 75 |
|
| 76 |
+
# Collect user input for edges to remove (before showing the "Generate" button)
|
| 77 |
+
selected_edges_per_graph = []
|
| 78 |
+
for i in range(7): # Loop over 7 graphs
|
| 79 |
+
selected_edges = st.multiselect(f"Select edges to remove for graph {i+1}:",
|
| 80 |
+
options=[str(edge) for edge in all_edges])
|
| 81 |
+
selected_edges_per_graph.append(selected_edges)
|
| 82 |
+
|
| 83 |
+
# Add "Generate" button after edge selection
|
| 84 |
generate_button = st.button("Generate Graph")
|
| 85 |
|
| 86 |
if generate_button:
|
|
|
|
| 88 |
axs = axs.flatten()
|
| 89 |
|
| 90 |
# Loop through each subplot and allow edge removal individually
|
| 91 |
+
for i in range(7): # Loop over 7 graphs
|
| 92 |
+
edges_to_remove = [tuple(eval(edge)) for edge in selected_edges_per_graph[i]]
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
|
| 94 |
# Remove the selected edges
|
| 95 |
G_custom_copy = G_custom.copy()
|