This commit is contained in:
parent
2c5c51e05f
commit
b15131bf1e
@ -46,5 +46,19 @@ class Solver(BaseSolver):
|
||||
if b != "end" and a != "start":
|
||||
neighbors[b].append(a)
|
||||
|
||||
if self.files:
|
||||
graph = "graph {\n"
|
||||
for node, neighbors_of in neighbors.items():
|
||||
graph += (
|
||||
" ".join(
|
||||
f"{node} -- {neighbor};"
|
||||
for neighbor in neighbors_of
|
||||
if node <= neighbor or node == "start" or neighbor == "end"
|
||||
)
|
||||
+ "\n"
|
||||
)
|
||||
graph += "}\n"
|
||||
self.files.create("graph.dot", graph.encode(), False)
|
||||
|
||||
yield len(list(enumerate_paths(neighbors)))
|
||||
yield len(list(enumerate_paths(neighbors, 1)))
|
||||
|
Loading…
Reference in New Issue
Block a user