Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -216,6 +216,7 @@ def display_tsp():
|
|
216 |
if sidebar_option == "Drawing: Traveling Salesman Problem":
|
217 |
display_tsp()
|
218 |
|
|
|
219 |
# Function to display Drawing: Spectral Embedding
|
220 |
def display_spectral_embedding():
|
221 |
st.title("Drawing: Spectral Embedding")
|
@@ -224,7 +225,7 @@ def display_spectral_embedding():
|
|
224 |
|
225 |
if option == "Default Example":
|
226 |
# Default example of spectral embedding with a grid graph
|
227 |
-
options = {"node_color": "C0", "node_size": 100}
|
228 |
G = nx.grid_2d_graph(6, 6)
|
229 |
|
230 |
fig, axs = plt.subplots(3, 3, figsize=(12, 12))
|
@@ -288,8 +289,8 @@ def display_spectral_embedding():
|
|
288 |
G_custom_copy = G_custom.copy()
|
289 |
G_custom_copy.remove_edges_from(edges_to_remove)
|
290 |
|
291 |
-
# Draw the graph with removed edges
|
292 |
-
nx.draw_spectral(G_custom_copy, **{"node_color": "C0", "node_size": 100}, ax=axs[i])
|
293 |
|
294 |
# Hide the last two subplots (8th and 9th)
|
295 |
for j in range(7, 9):
|
|
|
216 |
if sidebar_option == "Drawing: Traveling Salesman Problem":
|
217 |
display_tsp()
|
218 |
|
219 |
+
# Function to display Drawing: Spectral Embedding
|
220 |
# Function to display Drawing: Spectral Embedding
|
221 |
def display_spectral_embedding():
|
222 |
st.title("Drawing: Spectral Embedding")
|
|
|
225 |
|
226 |
if option == "Default Example":
|
227 |
# Default example of spectral embedding with a grid graph
|
228 |
+
options = {"node_color": "C0", "node_size": 100, "with_labels": True}
|
229 |
G = nx.grid_2d_graph(6, 6)
|
230 |
|
231 |
fig, axs = plt.subplots(3, 3, figsize=(12, 12))
|
|
|
289 |
G_custom_copy = G_custom.copy()
|
290 |
G_custom_copy.remove_edges_from(edges_to_remove)
|
291 |
|
292 |
+
# Draw the graph with removed edges and labels
|
293 |
+
nx.draw_spectral(G_custom_copy, **{"node_color": "C0", "node_size": 100, "with_labels": True}, ax=axs[i])
|
294 |
|
295 |
# Hide the last two subplots (8th and 9th)
|
296 |
for j in range(7, 9):
|