From 99e8d2d73a5785859d288d8c361ba3aeaec6b21f Mon Sep 17 00:00:00 2001 From: Lachlan Meyer Date: Mon, 23 Dec 2024 22:49:28 +1100 Subject: [PATCH] 23-2 --- 2024/23/23-2.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 2024/23/23-2.py diff --git a/2024/23/23-2.py b/2024/23/23-2.py new file mode 100644 index 0000000..a40a93c --- /dev/null +++ b/2024/23/23-2.py @@ -0,0 +1,14 @@ +import networkx as nx + +with open('2024/23/input.txt') as f: + graph = nx.Graph() + + for line in f: + line = line.strip() + connections = line.split('-') + graph.add_edge(connections[0], connections[1]) + + cliques = list(nx.find_cliques(graph)) + biggestClique = sorted(max(cliques, key=len)) + + print(','.join(biggestClique)) \ No newline at end of file