From bc6b5259c1dc89a6aca4c64671d85671fc3b8c28 Mon Sep 17 00:00:00 2001 From: Yanick Date: Sun, 18 Dec 2022 18:42:55 -0500 Subject: [PATCH] wip --- 2022/16/part1.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/2022/16/part1.js b/2022/16/part1.js index 9809253..8a06d49 100644 --- a/2022/16/part1.js +++ b/2022/16/part1.js @@ -1,6 +1,11 @@ import * as R from "remeda"; import u from "updeep"; +import Graph from 'graphology'; +import {bidirectional} from 'graphology-shortest-path'; + +import { combinations } from "combinatorial-generators"; + import { readFile } from "../05/part1.js"; const parseLine = (line) => { @@ -62,5 +67,12 @@ function bestMoveFor(tunnels,minutesLeft,opened,location='AA',totalSteam=0,activ export default (tunnels) => { - return bestMoveFor(tunnels,30,[]); + + const graph = new Graph(); + Object.entries(tunnels).forEach( ([location, { exits }]) => { + exits.forEach( exit => graph.addEdge(location, exit) ); + }); + + console.log(graph); + };