Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -79,9 +79,13 @@ def algorithms_greedy_coloring():
|
|
79 |
if st.button("Generate Graph"):
|
80 |
if nodes_input and edges_input:
|
81 |
try:
|
82 |
-
#
|
83 |
-
nodes =
|
84 |
-
|
|
|
|
|
|
|
|
|
85 |
|
86 |
G = nx.Graph()
|
87 |
G.add_nodes_from(nodes)
|
|
|
79 |
if st.button("Generate Graph"):
|
80 |
if nodes_input and edges_input:
|
81 |
try:
|
82 |
+
# Clean and parse the input for nodes (strip spaces, remove empty strings)
|
83 |
+
nodes = [node.strip() for node in nodes_input.split(",") if node.strip()]
|
84 |
+
nodes = list(map(int, nodes))
|
85 |
+
|
86 |
+
# Clean and parse the input for edges (strip spaces and remove empty strings)
|
87 |
+
edges = [edge.strip() for edge in edges_input.split("),") if edge.strip()]
|
88 |
+
edges = [tuple(map(int, edge.strip("()").split(","))) for edge in edges]
|
89 |
|
90 |
G = nx.Graph()
|
91 |
G.add_nodes_from(nodes)
|