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