Compare commits
	
		
			4 Commits
		
	
	
		
			665987395f
			...
			b879b6541a
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | b879b6541a | ||
|  | a9caa4c8f1 | ||
|  | dce2d06602 | ||
|  | 9177d35caf | 
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -1,3 +1,4 @@ | ||||
| /.direnv/ | ||||
| /.go | ||||
| input | ||||
| *.png | ||||
|  | ||||
							
								
								
									
										10
									
								
								day25/Snowerload.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								day25/Snowerload.go
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,10 @@ | ||||
| package day25 | ||||
| 
 | ||||
| import ( | ||||
| 	"fmt" | ||||
| ) | ||||
| 
 | ||||
| func Run() int { | ||||
| 	fmt.Println("time to wrap things up") | ||||
| 	return 0 | ||||
| } | ||||
							
								
								
									
										1440
									
								
								day25/after-removing-cycles.mmd
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1440
									
								
								day25/after-removing-cycles.mmd
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										13
									
								
								day25/example
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								day25/example
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,13 @@ | ||||
| jqt: rhn xhk nvd | ||||
| rsh: frs pzl lsr | ||||
| xhk: hfx | ||||
| cmg: qnr nvd lhk bvb | ||||
| rhn: xhk bvb hfx | ||||
| bvb: xhk hfx | ||||
| pzl: lsr hfx nvd | ||||
| qnr: nvd | ||||
| ntq: jqt hfx bvb xhk | ||||
| nvd: lhk | ||||
| lsr: lhk | ||||
| rzs: qnr cmg lsr rsh | ||||
| frs: qnr lhk lsr | ||||
							
								
								
									
										15
									
								
								day25/example-after-removing.mmd
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								day25/example-after-removing.mmd
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,15 @@ | ||||
| flowchart TD | ||||
| 	cmg --- qnr | ||||
| 	cmg --- lhk | ||||
| 	jqt --- nvd | ||||
| 	bvb --- rhn | ||||
| 	lsr --- pzl | ||||
| 	lhk --- lsr | ||||
| 	lsr --- rsh | ||||
| 	hfx --- ntq | ||||
| 	qnr --- rzs | ||||
| 	bvb --- hfx | ||||
| 	lhk --- nvd | ||||
| 	frs --- qnr | ||||
| 	jqt --- ntq | ||||
| 	rhn --- xhk | ||||
							
								
								
									
										34
									
								
								day25/example-before-removing.mmd
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								day25/example-before-removing.mmd
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,34 @@ | ||||
| flowchart TD | ||||
| 	ntq --- xhk | ||||
| 	bvb --- hfx | ||||
| 	lsr --- pzl | ||||
| 	nvd --- pzl | ||||
| 	pzl --- rsh | ||||
| 	frs --- lhk | ||||
| 	bvb --- cmg | ||||
| 	jqt --- xhk | ||||
| 	bvb --- rhn | ||||
| 	jqt --- rhn | ||||
| 	hfx --- xhk | ||||
| 	frs --- lsr | ||||
| 	lhk --- lsr | ||||
| 	jqt --- nvd | ||||
| 	cmg --- rzs | ||||
| 	hfx --- pzl | ||||
| 	bvb --- xhk | ||||
| 	rhn --- xhk | ||||
| 	frs --- rsh | ||||
| 	cmg --- qnr | ||||
| 	nvd --- qnr | ||||
| 	qnr --- rzs | ||||
| 	bvb --- ntq | ||||
| 	frs --- qnr | ||||
| 	cmg --- nvd | ||||
| 	hfx --- rhn | ||||
| 	jqt --- ntq | ||||
| 	hfx --- ntq | ||||
| 	lsr --- rsh | ||||
| 	cmg --- lhk | ||||
| 	rsh --- rzs | ||||
| 	lhk --- nvd | ||||
| 	lsr --- rzs | ||||
							
								
								
									
										34
									
								
								day25/example-graph.mmd
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								day25/example-graph.mmd
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,34 @@ | ||||
| flowchart TD | ||||
| 	hfx --- pzl | ||||
| 	cmg --- lhk | ||||
| 	lsr --- rsh | ||||
| 	rsh --- rzs | ||||
| 	bvb --- rhn | ||||
| 	jqt --- xhk | ||||
| 	nvd --- pzl | ||||
| 	lsr --- pzl | ||||
| 	frs --- qnr | ||||
| 	frs --- lsr | ||||
| 	lhk --- lsr | ||||
| 	lsr --- rzs | ||||
| 	rhn --- xhk | ||||
| 	hfx --- ntq | ||||
| 	nvd --- qnr | ||||
| 	qnr --- rzs | ||||
| 	bvb --- xhk | ||||
| 	hfx --- xhk | ||||
| 	jqt --- rhn | ||||
| 	jqt --- nvd | ||||
| 	cmg --- nvd | ||||
| 	lhk --- nvd | ||||
| 	frs --- rsh | ||||
| 	ntq --- xhk | ||||
| 	cmg --- rzs | ||||
| 	bvb --- ntq | ||||
| 	cmg --- qnr | ||||
| 	hfx --- rhn | ||||
| 	jqt --- ntq | ||||
| 	bvb --- cmg | ||||
| 	frs --- lhk | ||||
| 	pzl --- rsh | ||||
| 	bvb --- hfx | ||||
							
								
								
									
										1
									
								
								day25/example-graph.mmd.svg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								day25/example-graph.mmd.svg
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| After Width: | Height: | Size: 37 KiB | 
							
								
								
									
										3
									
								
								day25/example2
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								day25/example2
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,3 @@ | ||||
| jqt: rhn nvd rsh | ||||
| rsh: frs pzl lsr | ||||
| xhk: hfx | ||||
							
								
								
									
										301
									
								
								day25/graph.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										301
									
								
								day25/graph.go
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,301 @@ | ||||
| package day25 | ||||
| 
 | ||||
| import ( | ||||
| 	"fmt" | ||||
| 	"log" | ||||
| 	"os" | ||||
| 	"strings" | ||||
| 
 | ||||
| 	mapset "github.com/deckarep/golang-set/v2" | ||||
| ) | ||||
| 
 | ||||
| type Graph struct { | ||||
| 	Nodes map[string]*Node | ||||
| } | ||||
| 
 | ||||
| type Node struct { | ||||
| 	Name      string | ||||
| 	Neighbors mapset.Set[string] | ||||
| } | ||||
| 
 | ||||
| func (n Node) String() string { | ||||
| 	return fmt.Sprintf("[%s : %+v]", n.Name, n.Neighbors) | ||||
| } | ||||
| 
 | ||||
| func ReadGraphFile(filename string) (g Graph) { | ||||
| 	g.Nodes = map[string]*Node{} | ||||
| 
 | ||||
| 	bytes, err := os.ReadFile(filename) | ||||
| 	if err != nil { | ||||
| 		panic(err) | ||||
| 	} | ||||
| 	text := strings.TrimSpace(string(bytes)) | ||||
| 	for _, line := range strings.Split(text, "\n") { | ||||
| 		g.readGraphLine(line) | ||||
| 	} | ||||
| 
 | ||||
| 	return | ||||
| } | ||||
| 
 | ||||
| func (g *Graph) readGraphLine(l string)  { | ||||
| 	firstSplit := strings.Split(l, ":") | ||||
| 
 | ||||
| 	node, exists := g.Nodes[firstSplit[0]] | ||||
| 	if !exists { | ||||
| 		node = &Node{ | ||||
| 			Name:      firstSplit[0], | ||||
| 			Neighbors: mapset.NewSet[string](), | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	secondSplit := strings.Fields(firstSplit[1]) | ||||
| 
 | ||||
| 	for _, neighborName := range secondSplit { | ||||
| 		neighbor, exists := g.Nodes[neighborName] | ||||
| 		if !exists { | ||||
| 			neighbor = &Node{ | ||||
| 				Name:      neighborName, | ||||
| 				Neighbors: mapset.NewSet[string](), | ||||
| 			} | ||||
| 			g.Nodes[neighborName] = neighbor | ||||
| 		} | ||||
| 		neighbor.Neighbors.Add(node.Name) | ||||
| 		node.Neighbors.Add(neighbor.Name) | ||||
| 	} | ||||
| 
 | ||||
| 	g.Nodes[node.Name] = node | ||||
| 
 | ||||
| 	return | ||||
| } | ||||
| 
 | ||||
| // NOTE this is so sad. nodeA.Neighbors.Remove(nodeB.Name) hangs for a reason i don't understand | ||||
| func (g *Graph) RemoveEdge(a, b string) { | ||||
| 	// log.Printf("entering remove edge for %s and %s", a, b) | ||||
| 	nodeA, existsA := g.Nodes[a] | ||||
| 	// log.Println("got first node", nodeA, existsA) | ||||
| 	nodeB, existsB := g.Nodes[b] | ||||
| 	// log.Println("got second node", nodeB, existsB) | ||||
| 	if !existsA || !existsB { | ||||
| 		panic("requesting not found node") | ||||
| 	} | ||||
| 
 | ||||
| 	// log.Println("before removals") | ||||
| 	// log.Println("before remove first", nodeA) | ||||
| 	// nodeA.Neighbors = newANeighbors | ||||
| 	nodeA.Neighbors = nodeA.Neighbors.Difference(mapset.NewSet[string](nodeB.Name)) | ||||
| 	// nodeA.Neighbors.Remove(nodeB.Name) | ||||
| 	// log.Println("removed first", nodeA) | ||||
| 
 | ||||
| 	// log.Println("before remove second", nodeB) | ||||
| 	// nodeB.Neighbors = newBNeighbors | ||||
| 	nodeB.Neighbors = nodeB.Neighbors.Difference(mapset.NewSet[string](nodeA.Name)) | ||||
| 	// nodeB.Neighbors.Remove(nodeA.Name) | ||||
| 	// log.Println("removed second", nodeB) | ||||
| } | ||||
| 
 | ||||
| func (g *Graph) AddEdge(a, b string) { | ||||
| 	nodeA, existsA := g.Nodes[a] | ||||
| 	nodeB, existsB := g.Nodes[b] | ||||
| 	if !existsA || !existsB { | ||||
| 		panic("requesting not found node") | ||||
| 	} | ||||
| 	nodeA.Neighbors.Add(nodeB.Name) | ||||
| 	nodeB.Neighbors.Add(nodeA.Name) | ||||
| } | ||||
| 
 | ||||
| func (g *Graph) findCycle() (from, to string, exists bool) { | ||||
| 	// log.Printf(">>>> starting new find cycle") | ||||
| 	var firstNode *Node | ||||
| 	for _, n := range g.Nodes { | ||||
| 		firstNode = n | ||||
| 		break | ||||
| 	} | ||||
| 	// log.Printf("initial search from %s and neighbors %+v", firstNode.Name, firstNode.Neighbors) | ||||
| 	for neighborName := range firstNode.Neighbors.Iter() { | ||||
| 		initialVisited := mapset.NewSet[string](firstNode.Name) | ||||
| 		// log.Printf("initial dfs from %s to %s with initial visited %+v", firstNode.Name, neighborName, initialVisited) | ||||
| 		from, to, exists = g.dfcCycle(firstNode.Name, neighborName, initialVisited) | ||||
| 		if exists { | ||||
| 			break | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	// log.Printf("<<<< cycle %t, from %s to %s", exists, from, to) | ||||
| 	return | ||||
| } | ||||
| 
 | ||||
| func (g *Graph) dfcCycle(fromName, atName string, visited mapset.Set[string]) (cycleFrom, cycleTo string, cycleExists bool) { | ||||
| 	// log.Printf("> step from %+v to %+v. visited : %+v", fromName, atName, visited) | ||||
| 	if visited.Cardinality() == len(g.Nodes) { | ||||
| 		log.Println("exit by visited all") | ||||
| 		return | ||||
| 	} | ||||
| 
 | ||||
| 	atNode := g.Nodes[atName] | ||||
| 
 | ||||
| 	if visited.Contains(atName) { | ||||
| 		return fromName, atName, true | ||||
| 	} | ||||
| 
 | ||||
| 	for neighborName := range atNode.Neighbors.Iter() { | ||||
| 		if neighborName == fromName { | ||||
| 			continue | ||||
| 		} | ||||
| 		newVisited := visited.Clone() | ||||
| 		newVisited.Add(atName) | ||||
| 		cycleFrom, cycleTo, cycleExists = g.dfcCycle(atName, neighborName, newVisited) | ||||
| 		if cycleExists { | ||||
| 			break | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	return | ||||
| } | ||||
| 
 | ||||
| func (g *Graph) ComponentFrom(fromName string) (component mapset.Set[string]) { | ||||
| 	startNode := g.Nodes[fromName] | ||||
| 	component = mapset.NewSet[string](startNode.Name) | ||||
| 	toVisit := startNode.Neighbors.Clone() | ||||
| 
 | ||||
| 	for toVisit.Cardinality() > 0 { | ||||
| 		runnerNodeName, _ := toVisit.Pop() | ||||
| 		if component.Contains(runnerNodeName) { | ||||
| 			continue | ||||
| 		} | ||||
| 		component.Add(runnerNodeName) | ||||
| 		runnerNode := g.Nodes[runnerNodeName] | ||||
| 		unvisitedNeighbors := runnerNode.Neighbors.Difference(component) | ||||
| 		// log.Printf("adding %s to component. neighbors %+v, adding %+v to visit", | ||||
| 		// 	runnerNodeName, runnerNode.Neighbors, unvisitedNeighbors) | ||||
| 		toVisit = toVisit.Union(unvisitedNeighbors) | ||||
| 	} | ||||
| 
 | ||||
| 	return | ||||
| } | ||||
| 
 | ||||
| func (g *Graph) ToMermaid() (result string) { | ||||
| 	result += "flowchart TD\n" | ||||
| 	edges := mapset.NewSet[string]() | ||||
| 
 | ||||
| 	for _, node := range g.Nodes { | ||||
| 		for neighborName := range node.Neighbors.Iter() { | ||||
| 			var first, second string | ||||
| 			if node.Name < neighborName { | ||||
| 				first = node.Name | ||||
| 				second = neighborName | ||||
| 			} else { | ||||
| 				first = neighborName | ||||
| 				second = node.Name | ||||
| 			} | ||||
| 			edges.Add(fmt.Sprintf("\t%s --- %s\n", first, second)) | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	for line := range edges.Iter() { | ||||
| 		result += line | ||||
| 	} | ||||
| 	return | ||||
| } | ||||
| 
 | ||||
| func (g *Graph)SaveAsMermaid(filename string) { | ||||
| 	mmd := g.ToMermaid() | ||||
| 
 | ||||
| 	file, err := os.Create(filename) | ||||
| 	if err != nil { | ||||
| 		panic(err) | ||||
| 	} | ||||
| 	defer func() { | ||||
| 		if err := file.Close(); err != nil { | ||||
| 			panic(err) | ||||
| 		} | ||||
| 	}() | ||||
| 
 | ||||
| 	file.WriteString(mmd) | ||||
| } | ||||
| 
 | ||||
| type Edge struct { | ||||
| 	smaller, bigger string | ||||
| } | ||||
| func (e Edge)String() string { | ||||
| 	return fmt.Sprintf("%s/%s", e.smaller, e.bigger) | ||||
| } | ||||
| 
 | ||||
| func CreateEdge(a, b string) Edge { | ||||
| 	var smaller, bigger string | ||||
| 	if a < b { | ||||
| 		smaller = a | ||||
| 		bigger = b | ||||
| 	} else { | ||||
| 		smaller = b | ||||
| 		bigger = a | ||||
| 	} | ||||
| 	return Edge{smaller, bigger} | ||||
| } | ||||
| 
 | ||||
| func (g *Graph) RemoveAllCycles() (removedEdges mapset.Set[Edge]) { | ||||
| 	removedEdges = mapset.NewSet[Edge]() | ||||
| 	hasCycle := true | ||||
| 	var from, to string | ||||
| 	for hasCycle { | ||||
| 		from, to, hasCycle = g.findCycle() | ||||
| 		if hasCycle { | ||||
| 			// log.Printf("\n!!!! found cycle %s to %s\n", from, to) | ||||
| 			edgeToRemove := CreateEdge(from, to) | ||||
| 			removedEdges.Add(edgeToRemove) | ||||
| 			g.RemoveEdge(from, to) | ||||
| 		} | ||||
| 	} | ||||
| 	return | ||||
| } | ||||
| 
 | ||||
| func (g *Graph) TryToSplit() (componentSizeMult int) { | ||||
| 	// first remove all cycles | ||||
| 	removedEdges := g.RemoveAllCycles() | ||||
| 	g.SaveAsMermaid("after-removing-cycles.mmd") | ||||
| 	// log.Printf("all removed edges %+v, two of them are necessary to split initial graph into 2 ", removedEdges) | ||||
| 
 | ||||
| 	triedEdges := mapset.NewSet[Edge]() | ||||
| 
 | ||||
| 	for _, node := range g.Nodes { | ||||
| 		for neighborName := range node.Neighbors.Iter() { | ||||
| 			edge := CreateEdge(neighborName, node.Name) | ||||
| 			if triedEdges.Contains(edge) { | ||||
| 				continue | ||||
| 			} | ||||
| 			triedEdges.Add(edge) | ||||
| 			// first remove the edge | ||||
| 			g.RemoveEdge(edge.bigger, edge.smaller) | ||||
| 
 | ||||
| 			// then ask for components of the nodes of removed edge | ||||
| 			compA := g.ComponentFrom(edge.bigger) | ||||
| 			compB := g.ComponentFrom(edge.smaller) | ||||
| 
 | ||||
| 			// iterate over the initially removed edges. only two of them should be 'connecting' | ||||
| 			// i.e were necessary to remove | ||||
| 			necessaryEdgesCount := 0 | ||||
| 			for initiallyRemovedEdge := range removedEdges.Iter() { | ||||
| 				endA, endB := initiallyRemovedEdge.bigger, initiallyRemovedEdge.smaller | ||||
| 				isNonNecessary := (compA.Contains(endA) && compA.Contains(endB)) || (compB.Contains(endA) && compB.Contains(endB)) | ||||
| 				if !isNonNecessary { | ||||
| 					// log.Printf("with edge %+v test removed, the %+v also seems necessary", edge, initiallyRemovedEdge) | ||||
| 					necessaryEdgesCount += 1 | ||||
| 				} | ||||
| 			} | ||||
| 			// log.Printf("with edge %+v test removed neessary count is %d", edge, necessaryEdgesCount) | ||||
| 
 | ||||
| 			// if we found 2 necessary, then our currently tried edge is the third necesary to remove | ||||
| 			// and out two components are the searched | ||||
| 			if necessaryEdgesCount == 2 { | ||||
| 				return compA.Cardinality() * compB.Cardinality() | ||||
| 			} | ||||
| 
 | ||||
| 			// in the end add edge back if not fitting | ||||
| 			g.AddEdge(edge.bigger, edge.smaller) | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	// now huh. if we didn't find `necessaryEdgesCount == 2` | ||||
| 	// that means 0, 1 or 3 | ||||
| 
 | ||||
| 	return | ||||
| } | ||||
							
								
								
									
										96
									
								
								day25/graph_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										96
									
								
								day25/graph_test.go
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,96 @@ | ||||
| package day25 | ||||
| 
 | ||||
| import ( | ||||
| 	"testing" | ||||
| 
 | ||||
| 	mapset "github.com/deckarep/golang-set/v2" | ||||
| ) | ||||
| 
 | ||||
| func TestReadFileExample(t *testing.T) { | ||||
| 	filename := "example" | ||||
| 	g := ReadGraphFile(filename) | ||||
| 	t.Logf("read graph %+v", g) | ||||
| } | ||||
| 
 | ||||
| func TestRemoveEdge(t *testing.T) { | ||||
| 	filename := "example" | ||||
| 	g := ReadGraphFile(filename) | ||||
| 	t.Logf("read graph %+v", g) | ||||
| 
 | ||||
| 	g.RemoveEdge("bvb", "hfx") | ||||
| 	t.Logf("after removing bvb-hfv %+v", g) | ||||
| } | ||||
| 
 | ||||
| func TestCreateExampleMermaid(t *testing.T) { | ||||
| 	filename := "example" | ||||
| 	g := ReadGraphFile(filename) | ||||
| 
 | ||||
| 	g.SaveAsMermaid("example-graph.mmd") | ||||
| } | ||||
| 
 | ||||
| func TestComponentOnInitial(t *testing.T) { | ||||
| 	// should be all nodes | ||||
| 	filename := "example" | ||||
| 	g := ReadGraphFile(filename) | ||||
| 	comp := g.ComponentFrom("bvb") | ||||
| 	t.Logf("got component %+v", comp) | ||||
| 	if comp.Cardinality() != len(g.Nodes) { | ||||
| 		t.Errorf("should have same size!") | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| func TestComponentOnMini(t *testing.T) { | ||||
| 	// should be all nodes | ||||
| 	filename := "example2" | ||||
| 	g := ReadGraphFile(filename) | ||||
| 	comp := g.ComponentFrom("jqt") | ||||
| 	t.Logf("got component %+v", comp) | ||||
| 	if comp.Cardinality() == len(g.Nodes) { | ||||
| 		t.Errorf("should have different size!") | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| func TestRemoveAllCycles(t *testing.T) { | ||||
| 	filename := "example" | ||||
| 	g := ReadGraphFile(filename) | ||||
| 	g.SaveAsMermaid("example-before-removing.mmd") | ||||
| 	t.Logf("initial graph is %+v", g) | ||||
| 	edges := g.RemoveAllCycles() | ||||
| 	expectedNecessary := mapset.NewSet[Edge]( | ||||
| 		CreateEdge("hfx", "pzl"), | ||||
| 		CreateEdge("bvb", "cmg"), | ||||
| 		CreateEdge("nvd", "jqt"), | ||||
| 	) | ||||
| 
 | ||||
| 	intersection := expectedNecessary.Intersect(edges) | ||||
| 	t.Logf("i expect that exactly two will be in intersection %+v", intersection) | ||||
| 	if intersection.Cardinality() != 2 { | ||||
| 		panic("huh?") | ||||
| 		// ok, this is not what i expected. | ||||
| 		// this is unstable. but i could run it several times? and hopefully luck out? | ||||
| 	} | ||||
| 
 | ||||
| 	t.Logf("removed edges %+v", edges) | ||||
| 	t.Logf("after removal graph is %+v", g) | ||||
| 	g.SaveAsMermaid("example-after-removing.mmd") | ||||
| } | ||||
| 
 | ||||
| func TestSplittingExample(t *testing.T) { | ||||
| 	filename := "example" | ||||
| 	g := ReadGraphFile(filename) | ||||
| 	result := g.TryToSplit() | ||||
| 	t.Logf("hopefully same as example answer: %d", result) | ||||
| } | ||||
| 
 | ||||
| func TestSplittingInput(t *testing.T) { | ||||
| 	// kind of brute force | ||||
| 	result := 0 | ||||
| 	filename := "input" | ||||
| 
 | ||||
| 	for result == 0 { | ||||
| 		g := ReadGraphFile(filename) | ||||
| 		result = g.TryToSplit() | ||||
| 		t.Logf("hopefully as answer: %d", result) | ||||
| 	} | ||||
| 
 | ||||
| } | ||||
							
								
								
									
										480
									
								
								day25/notes.org
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										480
									
								
								day25/notes.org
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,480 @@ | ||||
| #+title: Notes | ||||
| * ok, not so simple | ||||
| 'how to find 3 edges which if removed split graph into 2 components' | ||||
| 
 | ||||
| i guess i could find all cycles? | ||||
| and then what? | ||||
| 
 | ||||
| then if i have graph without cycles and all of the removed edges, | ||||
| maybe i can figure out how to remove one edge, to make two components, and all (k - 2) edges back in a way that would not connect those components. | ||||
| 
 | ||||
| well, the cycles maybe should have been broken elsewhere? | ||||
| for most cycles - it doesn't matter. | ||||
| 
 | ||||
| for cycles that break into 2 components, does it? | ||||
| 
 | ||||
| ok. if i have the no-cycle graph. | ||||
| then we can maybe start searching for 'third' edge to remove. | ||||
| 
 | ||||
| i remove it, i get two components. | ||||
| then as a test - exactly two edges when added should connect those components. | ||||
| if that happens - i have an answer | ||||
| 
 | ||||
| sounds good | ||||
| ** making code to get components. | ||||
| now. | ||||
| ** make method to remove all cycles. | ||||
| save the removed edges to slice | ||||
| 
 | ||||
| i guess could be a method that modifies the graph and returns all removed edges. | ||||
| and test that | ||||
| ** why a node ends up without any edges? | ||||
| #+begin_src | ||||
| === RUN   TestRemoveAllCycles | ||||
|     graph_test.go:55: initial graph is {Nodes:map[bvb:[bvb : Set{xhk, hfx, ntq}] cmg:[cmg : Set{qnr, nvd, lhk, bvb, rzs}] frs:[frs : Set{qnr, lhk, lsr}] hfx:[hfx : Set{rhn, bvb, pzl, ntq, xhk}] jqt:[jqt : Set{rhn, xhk, nvd, ntq}] lhk:[lhk : Set{nvd, lsr, frs, cmg}] lsr:[lsr : Set{rzs, frs, lhk}] ntq:[ntq : Set{jqt, hfx, bvb, xhk}] nvd:[nvd : Set{lhk}] pzl:[pzl : Set{lsr, hfx, nvd}] qnr:[qnr : Set{nvd, rzs, frs}] rhn:[rhn : Set{bvb, hfx, xhk}] rsh:[rsh : Set{lsr, rzs, frs, pzl}] rzs:[rzs : Set{lsr, rsh, qnr, cmg}] xhk:[xhk : Set{hfx, rhn, bvb, ntq}]]} | ||||
| 2023/12/25 08:14:02 >>>> starting new find cycle | ||||
| 2023/12/25 08:14:02 initial search from lsr and neighbors Set{lhk, rzs, frs} | ||||
| 2023/12/25 08:14:02 initial dfs from lsr to lhk with initial visited Set{lsr} | ||||
| 2023/12/25 08:14:02 > step from lsr to lhk. visited : Set{lsr} | ||||
| 2023/12/25 08:14:02 > step from lhk to frs. visited : Set{lsr, lhk} | ||||
| 2023/12/25 08:14:02 > step from frs to lsr. visited : Set{lhk, frs, lsr} | ||||
| 2023/12/25 08:14:02 <<<< cycle true, from frs to lsr | ||||
| 2023/12/25 08:14:02 entering remove edge for frs and lsr | ||||
| 2023/12/25 08:14:02 removed first [frs : Set{qnr, lhk}] | ||||
| 2023/12/25 08:14:02 removed second [lsr : Set{lhk, rzs}] | ||||
| 2023/12/25 08:14:02 >>>> starting new find cycle | ||||
| 2023/12/25 08:14:02 initial search from xhk and neighbors Set{hfx, rhn, bvb, ntq} | ||||
| 2023/12/25 08:14:02 initial dfs from xhk to ntq with initial visited Set{xhk} | ||||
| 2023/12/25 08:14:02 > step from xhk to ntq. visited : Set{xhk} | ||||
| 2023/12/25 08:14:02 > step from ntq to jqt. visited : Set{xhk, ntq} | ||||
| 2023/12/25 08:14:02 > step from jqt to rhn. visited : Set{xhk, ntq, jqt} | ||||
| 2023/12/25 08:14:02 > step from rhn to bvb. visited : Set{rhn, xhk, ntq, jqt} | ||||
| 2023/12/25 08:14:02 > step from bvb to xhk. visited : Set{xhk, ntq, jqt, rhn, bvb} | ||||
| 2023/12/25 08:14:02 <<<< cycle true, from bvb to xhk | ||||
| 2023/12/25 08:14:02 entering remove edge for bvb and xhk | ||||
| 2023/12/25 08:14:02 removed first [bvb : Set{hfx, ntq}] | ||||
| 2023/12/25 08:14:02 removed second [xhk : Set{ntq, hfx, rhn}] | ||||
| 2023/12/25 08:14:02 >>>> starting new find cycle | ||||
| 2023/12/25 08:14:02 initial search from rhn and neighbors Set{bvb, hfx, xhk} | ||||
| 2023/12/25 08:14:02 initial dfs from rhn to xhk with initial visited Set{rhn} | ||||
| 2023/12/25 08:14:02 > step from rhn to xhk. visited : Set{rhn} | ||||
| 2023/12/25 08:14:02 > step from xhk to hfx. visited : Set{rhn, xhk} | ||||
| 2023/12/25 08:14:02 > step from hfx to bvb. visited : Set{rhn, xhk, hfx} | ||||
| 2023/12/25 08:14:02 > step from bvb to hfx. visited : Set{hfx, rhn, xhk, bvb} | ||||
| 2023/12/25 08:14:02 <<<< cycle true, from bvb to hfx | ||||
| 2023/12/25 08:14:02 entering remove edge for bvb and hfx | ||||
| 2023/12/25 08:14:02 removed first [bvb : Set{ntq}] | ||||
| 2023/12/25 08:14:02 removed second [hfx : Set{rhn, pzl, ntq, xhk}] | ||||
| 2023/12/25 08:14:02 >>>> starting new find cycle | ||||
| 2023/12/25 08:14:02 initial search from rsh and neighbors Set{frs, pzl, lsr, rzs} | ||||
| 2023/12/25 08:14:02 initial dfs from rsh to frs with initial visited Set{rsh} | ||||
| 2023/12/25 08:14:02 > step from rsh to frs. visited : Set{rsh} | ||||
| 2023/12/25 08:14:02 > step from frs to qnr. visited : Set{rsh, frs} | ||||
| 2023/12/25 08:14:02 > step from qnr to nvd. visited : Set{qnr, rsh, frs} | ||||
| 2023/12/25 08:14:02 > step from nvd to lhk. visited : Set{rsh, frs, qnr, nvd} | ||||
| 2023/12/25 08:14:02 > step from lhk to cmg. visited : Set{rsh, frs, qnr, nvd, lhk} | ||||
| 2023/12/25 08:14:02 > step from cmg to qnr. visited : Set{rsh, frs, qnr, nvd, lhk, cmg} | ||||
| 2023/12/25 08:14:02 <<<< cycle true, from cmg to qnr | ||||
| 2023/12/25 08:14:02 entering remove edge for cmg and qnr | ||||
| 2023/12/25 08:14:02 removed first [cmg : Set{nvd, lhk, bvb, rzs}] | ||||
| 2023/12/25 08:14:02 removed second [qnr : Set{nvd, rzs, frs}] | ||||
| 2023/12/25 08:14:02 >>>> starting new find cycle | ||||
| 2023/12/25 08:14:02 initial search from rzs and neighbors Set{rsh, qnr, cmg, lsr} | ||||
| 2023/12/25 08:14:02 initial dfs from rzs to cmg with initial visited Set{rzs} | ||||
| 2023/12/25 08:14:02 > step from rzs to cmg. visited : Set{rzs} | ||||
| 2023/12/25 08:14:02 > step from cmg to nvd. visited : Set{rzs, cmg} | ||||
| 2023/12/25 08:14:02 > step from nvd to lhk. visited : Set{cmg, nvd, rzs} | ||||
| 2023/12/25 08:14:02 > step from lhk to cmg. visited : Set{cmg, lhk, nvd, rzs} | ||||
| 2023/12/25 08:14:02 <<<< cycle true, from lhk to cmg | ||||
| 2023/12/25 08:14:02 entering remove edge for lhk and cmg | ||||
| 2023/12/25 08:14:02 removed first [lhk : Set{frs, nvd, lsr}] | ||||
| 2023/12/25 08:14:02 removed second [cmg : Set{rzs, nvd, bvb}] | ||||
| 2023/12/25 08:14:02 >>>> starting new find cycle | ||||
| 2023/12/25 08:14:02 initial search from qnr and neighbors Set{nvd, rzs, frs} | ||||
| 2023/12/25 08:14:02 initial dfs from qnr to nvd with initial visited Set{qnr} | ||||
| 2023/12/25 08:14:02 > step from qnr to nvd. visited : Set{qnr} | ||||
| 2023/12/25 08:14:02 > step from nvd to lhk. visited : Set{qnr, nvd} | ||||
| 2023/12/25 08:14:02 > step from lhk to nvd. visited : Set{lhk, qnr, nvd} | ||||
| 2023/12/25 08:14:02 <<<< cycle true, from lhk to nvd | ||||
| 2023/12/25 08:14:02 entering remove edge for lhk and nvd | ||||
| 2023/12/25 08:14:02 removed first [lhk : Set{lsr, frs}] | ||||
| 2023/12/25 08:14:02 removed second [nvd : Set{}] | ||||
| 2023/12/25 08:14:02 >>>> starting new find cycle | ||||
| 2023/12/25 08:14:02 initial search from jqt and neighbors Set{rhn, xhk, nvd, ntq} | ||||
| 2023/12/25 08:14:02 initial dfs from jqt to xhk with initial visited Set{jqt} | ||||
| 2023/12/25 08:14:02 > step from jqt to xhk. visited : Set{jqt} | ||||
| 2023/12/25 08:14:02 > step from xhk to ntq. visited : Set{jqt, xhk} | ||||
| 2023/12/25 08:14:02 > step from ntq to bvb. visited : Set{jqt, xhk, ntq} | ||||
| 2023/12/25 08:14:02 > step from bvb to ntq. visited : Set{jqt, xhk, ntq, bvb} | ||||
| 2023/12/25 08:14:02 <<<< cycle true, from bvb to ntq | ||||
| 2023/12/25 08:14:02 entering remove edge for bvb and ntq | ||||
| 2023/12/25 08:14:02 removed first [bvb : Set{}] | ||||
| 2023/12/25 08:14:02 removed second [ntq : Set{jqt, hfx, xhk}] | ||||
| 2023/12/25 08:14:02 >>>> starting new find cycle | ||||
| 2023/12/25 08:14:02 initial search from xhk and neighbors Set{hfx, rhn, ntq} | ||||
| 2023/12/25 08:14:02 initial dfs from xhk to hfx with initial visited Set{xhk} | ||||
| 2023/12/25 08:14:02 > step from xhk to hfx. visited : Set{xhk} | ||||
| 2023/12/25 08:14:02 > step from hfx to xhk. visited : Set{xhk, hfx} | ||||
| 2023/12/25 08:14:02 <<<< cycle true, from hfx to xhk | ||||
| 2023/12/25 08:14:02 entering remove edge for hfx and xhk | ||||
| 2023/12/25 08:14:02 removed first [hfx : Set{ntq, rhn, pzl}] | ||||
| 2023/12/25 08:14:02 removed second [xhk : Set{rhn, ntq}] | ||||
| 2023/12/25 08:14:02 >>>> starting new find cycle | ||||
| 2023/12/25 08:14:02 initial search from lsr and neighbors Set{lhk, rzs} | ||||
| 2023/12/25 08:14:02 initial dfs from lsr to rzs with initial visited Set{lsr} | ||||
| 2023/12/25 08:14:02 > step from lsr to rzs. visited : Set{lsr} | ||||
| 2023/12/25 08:14:02 > step from rzs to qnr. visited : Set{lsr, rzs} | ||||
| 2023/12/25 08:14:02 > step from qnr to rzs. visited : Set{lsr, rzs, qnr} | ||||
| 2023/12/25 08:14:02 <<<< cycle true, from qnr to rzs | ||||
| 2023/12/25 08:14:02 entering remove edge for qnr and rzs | ||||
| 2023/12/25 08:14:02 removed first [qnr : Set{frs, nvd}] | ||||
| 2023/12/25 08:14:02 removed second [rzs : Set{cmg, lsr, rsh}] | ||||
| 2023/12/25 08:14:02 >>>> starting new find cycle | ||||
| 2023/12/25 08:14:02 initial search from pzl and neighbors Set{lsr, hfx, nvd} | ||||
| 2023/12/25 08:14:02 initial dfs from pzl to lsr with initial visited Set{pzl} | ||||
| 2023/12/25 08:14:02 > step from pzl to lsr. visited : Set{pzl} | ||||
| 2023/12/25 08:14:02 > step from lsr to lhk. visited : Set{pzl, lsr} | ||||
| 2023/12/25 08:14:02 > step from lhk to lsr. visited : Set{lsr, lhk, pzl} | ||||
| 2023/12/25 08:14:02 <<<< cycle true, from lhk to lsr | ||||
| 2023/12/25 08:14:02 entering remove edge for lhk and lsr | ||||
| 2023/12/25 08:14:02 removed first [lhk : Set{frs}] | ||||
| 2023/12/25 08:14:02 removed second [lsr : Set{rzs}] | ||||
| 2023/12/25 08:14:02 >>>> starting new find cycle | ||||
| 2023/12/25 08:14:02 initial search from rhn and neighbors Set{xhk, bvb, hfx} | ||||
| 2023/12/25 08:14:02 initial dfs from rhn to xhk with initial visited Set{rhn} | ||||
| 2023/12/25 08:14:02 > step from rhn to xhk. visited : Set{rhn} | ||||
| 2023/12/25 08:14:02 > step from xhk to rhn. visited : Set{xhk, rhn} | ||||
| 2023/12/25 08:14:02 <<<< cycle true, from xhk to rhn | ||||
| 2023/12/25 08:14:02 entering remove edge for xhk and rhn | ||||
| 2023/12/25 08:14:02 removed first [xhk : Set{ntq}] | ||||
| 2023/12/25 08:14:02 removed second [rhn : Set{bvb, hfx}] | ||||
| 2023/12/25 08:14:02 >>>> starting new find cycle | ||||
| 2023/12/25 08:14:02 initial search from rsh and neighbors Set{frs, pzl, lsr, rzs} | ||||
| 2023/12/25 08:14:02 initial dfs from rsh to frs with initial visited Set{rsh} | ||||
| 2023/12/25 08:14:02 > step from rsh to frs. visited : Set{rsh} | ||||
| 2023/12/25 08:14:02 > step from frs to qnr. visited : Set{rsh, frs} | ||||
| 2023/12/25 08:14:02 > step from qnr to frs. visited : Set{rsh, frs, qnr} | ||||
| 2023/12/25 08:14:02 <<<< cycle true, from qnr to frs | ||||
| 2023/12/25 08:14:02 entering remove edge for qnr and frs | ||||
| 2023/12/25 08:14:02 removed first [qnr : Set{nvd}] | ||||
| 2023/12/25 08:14:02 removed second [frs : Set{lhk}] | ||||
| 2023/12/25 08:14:02 >>>> starting new find cycle | ||||
| 2023/12/25 08:14:02 initial search from rhn and neighbors Set{bvb, hfx} | ||||
| 2023/12/25 08:14:02 initial dfs from rhn to hfx with initial visited Set{rhn} | ||||
| 2023/12/25 08:14:02 > step from rhn to hfx. visited : Set{rhn} | ||||
| 2023/12/25 08:14:02 > step from hfx to rhn. visited : Set{rhn, hfx} | ||||
| 2023/12/25 08:14:02 <<<< cycle true, from hfx to rhn | ||||
| 2023/12/25 08:14:02 entering remove edge for hfx and rhn | ||||
| 2023/12/25 08:14:02 removed first [hfx : Set{pzl, ntq}] | ||||
| 2023/12/25 08:14:02 removed second [rhn : Set{bvb}] | ||||
| 2023/12/25 08:14:02 >>>> starting new find cycle | ||||
| 2023/12/25 08:14:02 initial search from pzl and neighbors Set{hfx, nvd, lsr} | ||||
| 2023/12/25 08:14:02 initial dfs from pzl to lsr with initial visited Set{pzl} | ||||
| 2023/12/25 08:14:02 > step from pzl to lsr. visited : Set{pzl} | ||||
| 2023/12/25 08:14:02 > step from lsr to rzs. visited : Set{pzl, lsr} | ||||
| 2023/12/25 08:14:02 > step from rzs to cmg. visited : Set{pzl, lsr, rzs} | ||||
| 2023/12/25 08:14:02 > step from cmg to rzs. visited : Set{pzl, lsr, rzs, cmg} | ||||
| 2023/12/25 08:14:02 <<<< cycle true, from cmg to rzs | ||||
| 2023/12/25 08:14:02 entering remove edge for cmg and rzs | ||||
| 2023/12/25 08:14:02 removed first [cmg : Set{nvd, bvb}] | ||||
| 2023/12/25 08:14:02 removed second [rzs : Set{lsr, rsh}] | ||||
| 2023/12/25 08:14:02 >>>> starting new find cycle | ||||
| 2023/12/25 08:14:02 initial search from rhn and neighbors Set{bvb} | ||||
| 2023/12/25 08:14:02 initial dfs from rhn to bvb with initial visited Set{rhn} | ||||
| 2023/12/25 08:14:02 > step from rhn to bvb. visited : Set{rhn} | ||||
| 2023/12/25 08:14:02 <<<< cycle false, from  to | ||||
|     graph_test.go:57: removed edges Set{{lhk nvd}, {hfx xhk}, {frs qnr}, {cmg rzs}, {bvb xhk}, {bvb hfx}, {cmg qnr}, {cmg lhk}, {qnr rzs}, {hfx rhn}, {frs lsr}, {rhn xhk}, {bvb ntq}, {lhk lsr}} | ||||
|     graph_test.go:58: after removal graph is {Nodes:map[bvb:[bvb : Set{}] cmg:[cmg : Set{nvd, bvb}] frs:[frs : Set{lhk}] hfx:[hfx : Set{pzl, ntq}] jqt:[jqt : Set{rhn, xhk, nvd, ntq}] lhk:[lhk : Set{frs}] lsr:[lsr : Set{rzs}] ntq:[ntq : Set{xhk, jqt, hfx}] nvd:[nvd : Set{}] pzl:[pzl : Set{nvd, lsr, hfx}] qnr:[qnr : Set{nvd}] rhn:[rhn : Set{bvb}] rsh:[rsh : Set{frs, pzl, lsr, rzs}] rzs:[rzs : Set{lsr, rsh}] xhk:[xhk : Set{ntq}]]} | ||||
| --- PASS: TestRemoveAllCycles (0.00s) | ||||
| 
 | ||||
| #+end_src | ||||
| *** because i was overwriting nodes on file read | ||||
| ** now why i get empty sets? | ||||
| #+begin_src | ||||
| === RUN   TestRemoveAllCycles | ||||
|     graph_test.go:55: initial graph is {Nodes:map[bvb:[bvb : Set{cmg, rhn, xhk, hfx, ntq}] cmg:[cmg : Set{lhk, bvb, rzs, qnr, nvd}] frs:[frs : Set{rsh, qnr, lhk, lsr}] hfx:[hfx : Set{xhk, rhn, bvb, pzl, ntq}] jqt:[jqt : Set{rhn, xhk, nvd, ntq}] lhk:[lhk : Set{nvd, lsr, frs, cmg}] lsr:[lsr : Set{rsh, pzl, lhk, rzs, frs}] ntq:[ntq : Set{jqt, hfx, bvb, xhk}] nvd:[nvd : Set{pzl, qnr, lhk, jqt, cmg}] pzl:[pzl : Set{hfx, nvd, rsh, lsr}] qnr:[qnr : Set{cmg, nvd, rzs, frs}] rhn:[rhn : Set{jqt, xhk, bvb, hfx}] rsh:[rsh : Set{lsr, rzs, frs, pzl}] rzs:[rzs : Set{qnr, cmg, lsr, rsh}] xhk:[xhk : Set{hfx, rhn, bvb, ntq, jqt}]]} | ||||
| 2023/12/25 08:31:09 >>>> starting new find cycle | ||||
| 2023/12/25 08:31:09 initial search from xhk and neighbors Set{rhn, bvb, ntq, jqt, hfx} | ||||
| 2023/12/25 08:31:09 initial dfs from xhk to rhn with initial visited Set{xhk} | ||||
| 2023/12/25 08:31:09 > step from xhk to rhn. visited : Set{xhk} | ||||
| 2023/12/25 08:31:09 > step from rhn to jqt. visited : Set{xhk, rhn} | ||||
| 2023/12/25 08:31:09 > step from jqt to rhn. visited : Set{xhk, rhn, jqt} | ||||
| 2023/12/25 08:31:09 <<<< cycle true, from jqt to rhn | ||||
| 2023/12/25 08:31:09 entering remove edge for jqt and rhn | ||||
| 2023/12/25 08:31:09 before remove first [jqt : Set{xhk, nvd, ntq, rhn}] | ||||
| 2023/12/25 08:31:09 removed first [jqt : Set{ntq, xhk, nvd}] | ||||
| 2023/12/25 08:31:09 before remove second [jqt : Set{nvd, ntq, xhk}] | ||||
| 2023/12/25 08:31:09 removed second [rhn : Set{hfx, xhk, bvb}] | ||||
| 2023/12/25 08:31:09 >>>> starting new find cycle | ||||
| 2023/12/25 08:31:09 initial search from pzl and neighbors Set{hfx, nvd, rsh, lsr} | ||||
| 2023/12/25 08:31:09 initial dfs from pzl to nvd with initial visited Set{pzl} | ||||
| 2023/12/25 08:31:09 > step from pzl to nvd. visited : Set{pzl} | ||||
| 2023/12/25 08:31:09 > step from nvd to jqt. visited : Set{pzl, nvd} | ||||
| 2023/12/25 08:31:09 > step from jqt to ntq. visited : Set{pzl, nvd, jqt} | ||||
| 2023/12/25 08:31:09 > step from ntq to xhk. visited : Set{pzl, nvd, jqt, ntq} | ||||
| 2023/12/25 08:31:09 > step from xhk to jqt. visited : Set{ntq, pzl, nvd, jqt, xhk} | ||||
| 2023/12/25 08:31:09 <<<< cycle true, from xhk to jqt | ||||
| 2023/12/25 08:31:09 entering remove edge for xhk and jqt | ||||
| 2023/12/25 08:31:09 before remove first [xhk : Set{jqt, hfx, rhn, bvb, ntq}] | ||||
| 2023/12/25 08:31:09 removed first [xhk : Set{ntq, hfx, rhn, bvb}] | ||||
| 2023/12/25 08:31:09 before remove second [xhk : Set{hfx, rhn, bvb, ntq}] | ||||
| 2023/12/25 08:31:09 removed second [jqt : Set{nvd, ntq}] | ||||
| 2023/12/25 08:31:09 >>>> starting new find cycle | ||||
| 2023/12/25 08:31:09 initial search from frs and neighbors Set{rsh, qnr, lhk, lsr} | ||||
| 2023/12/25 08:31:09 initial dfs from frs to lhk with initial visited Set{frs} | ||||
| 2023/12/25 08:31:09 > step from frs to lhk. visited : Set{frs} | ||||
| 2023/12/25 08:31:09 > step from lhk to nvd. visited : Set{frs, lhk} | ||||
| 2023/12/25 08:31:09 > step from nvd to cmg. visited : Set{lhk, frs, nvd} | ||||
| 2023/12/25 08:31:09 > step from cmg to lhk. visited : Set{frs, nvd, lhk, cmg} | ||||
| 2023/12/25 08:31:09 <<<< cycle true, from cmg to lhk | ||||
| 2023/12/25 08:31:09 entering remove edge for cmg and lhk | ||||
| 2023/12/25 08:31:09 before remove first [cmg : Set{qnr, nvd, lhk, bvb, rzs}] | ||||
| 2023/12/25 08:31:09 removed first [cmg : Set{nvd, bvb, rzs, qnr}] | ||||
| 2023/12/25 08:31:09 before remove second [cmg : Set{bvb, rzs, qnr, nvd}] | ||||
| 2023/12/25 08:31:09 removed second [lhk : Set{nvd, lsr, frs}] | ||||
| 2023/12/25 08:31:09 >>>> starting new find cycle | ||||
| 2023/12/25 08:31:09 initial search from xhk and neighbors Set{hfx, rhn, bvb, ntq} | ||||
| 2023/12/25 08:31:09 initial dfs from xhk to ntq with initial visited Set{xhk} | ||||
| 2023/12/25 08:31:09 > step from xhk to ntq. visited : Set{xhk} | ||||
| 2023/12/25 08:31:09 > step from ntq to jqt. visited : Set{xhk, ntq} | ||||
| 2023/12/25 08:31:09 > step from jqt to ntq. visited : Set{xhk, ntq, jqt} | ||||
| 2023/12/25 08:31:09 <<<< cycle true, from jqt to ntq | ||||
| 2023/12/25 08:31:09 entering remove edge for jqt and ntq | ||||
| 2023/12/25 08:31:09 before remove first [jqt : Set{ntq, nvd}] | ||||
| 2023/12/25 08:31:09 removed first [jqt : Set{nvd}] | ||||
| 2023/12/25 08:31:09 before remove second [jqt : Set{nvd}] | ||||
| 2023/12/25 08:31:09 removed second [ntq : Set{xhk, hfx, bvb}] | ||||
| 2023/12/25 08:31:09 >>>> starting new find cycle | ||||
| 2023/12/25 08:31:09 initial search from nvd and neighbors Set{jqt, cmg, pzl, qnr, lhk} | ||||
| 2023/12/25 08:31:09 initial dfs from nvd to cmg with initial visited Set{nvd} | ||||
| 2023/12/25 08:31:09 > step from nvd to cmg. visited : Set{nvd} | ||||
| 2023/12/25 08:31:09 > step from cmg to bvb. visited : Set{nvd, cmg} | ||||
| 2023/12/25 08:31:09 > step from bvb to cmg. visited : Set{cmg, nvd, bvb} | ||||
| 2023/12/25 08:31:09 <<<< cycle true, from bvb to cmg | ||||
| 2023/12/25 08:31:09 entering remove edge for bvb and cmg | ||||
| 2023/12/25 08:31:09 before remove first [bvb : Set{cmg, rhn, xhk, hfx, ntq}] | ||||
| 2023/12/25 08:31:09 removed first [bvb : Set{xhk, hfx, ntq, rhn}] | ||||
| 2023/12/25 08:31:09 before remove second [bvb : Set{rhn, xhk, hfx, ntq}] | ||||
| 2023/12/25 08:31:09 removed second [cmg : Set{rzs, qnr, nvd}] | ||||
| 2023/12/25 08:31:09 >>>> starting new find cycle | ||||
| 2023/12/25 08:31:09 initial search from frs and neighbors Set{rsh, qnr, lhk, lsr} | ||||
| 2023/12/25 08:31:09 initial dfs from frs to lsr with initial visited Set{frs} | ||||
| 2023/12/25 08:31:09 > step from frs to lsr. visited : Set{frs} | ||||
| 2023/12/25 08:31:09 > step from lsr to rzs. visited : Set{frs, lsr} | ||||
| 2023/12/25 08:31:09 > step from rzs to cmg. visited : Set{frs, lsr, rzs} | ||||
| 2023/12/25 08:31:09 > step from cmg to rzs. visited : Set{lsr, rzs, cmg, frs} | ||||
| 2023/12/25 08:31:09 <<<< cycle true, from cmg to rzs | ||||
| 2023/12/25 08:31:09 entering remove edge for cmg and rzs | ||||
| 2023/12/25 08:31:09 before remove first [cmg : Set{rzs, qnr, nvd}] | ||||
| 2023/12/25 08:31:09 removed first [cmg : Set{qnr, nvd}] | ||||
| 2023/12/25 08:31:09 before remove second [cmg : Set{qnr, nvd}] | ||||
| 2023/12/25 08:31:09 removed second [rzs : Set{lsr, rsh, qnr}] | ||||
| 2023/12/25 08:31:09 >>>> starting new find cycle | ||||
| 2023/12/25 08:31:09 initial search from ntq and neighbors Set{xhk, hfx, bvb} | ||||
| 2023/12/25 08:31:09 initial dfs from ntq to bvb with initial visited Set{ntq} | ||||
| 2023/12/25 08:31:09 > step from ntq to bvb. visited : Set{ntq} | ||||
| 2023/12/25 08:31:09 > step from bvb to rhn. visited : Set{ntq, bvb} | ||||
| 2023/12/25 08:31:09 > step from rhn to xhk. visited : Set{bvb, ntq, rhn} | ||||
| 2023/12/25 08:31:09 > step from xhk to hfx. visited : Set{bvb, ntq, rhn, xhk} | ||||
| 2023/12/25 08:31:09 > step from hfx to bvb. visited : Set{xhk, bvb, ntq, rhn, hfx} | ||||
| 2023/12/25 08:31:09 <<<< cycle true, from hfx to bvb | ||||
| 2023/12/25 08:31:09 entering remove edge for hfx and bvb | ||||
| 2023/12/25 08:31:09 before remove first [hfx : Set{rhn, bvb, pzl, ntq, xhk}] | ||||
| 2023/12/25 08:31:09 removed first [hfx : Set{ntq, xhk, rhn, pzl}] | ||||
| 2023/12/25 08:31:09 before remove second [hfx : Set{pzl, ntq, xhk, rhn}] | ||||
| 2023/12/25 08:31:09 removed second [bvb : Set{ntq, rhn, xhk}] | ||||
| 2023/12/25 08:31:09 >>>> starting new find cycle | ||||
| 2023/12/25 08:31:09 initial search from rhn and neighbors Set{xhk, bvb, hfx} | ||||
| 2023/12/25 08:31:09 initial dfs from rhn to bvb with initial visited Set{rhn} | ||||
| 2023/12/25 08:31:09 > step from rhn to bvb. visited : Set{rhn} | ||||
| 2023/12/25 08:31:09 > step from bvb to rhn. visited : Set{bvb, rhn} | ||||
| 2023/12/25 08:31:09 <<<< cycle true, from bvb to rhn | ||||
| 2023/12/25 08:31:09 entering remove edge for bvb and rhn | ||||
| 2023/12/25 08:31:09 before remove first [bvb : Set{ntq, rhn, xhk}] | ||||
| 2023/12/25 08:31:09 removed first [bvb : Set{ntq, xhk}] | ||||
| 2023/12/25 08:31:09 before remove second [bvb : Set{ntq, xhk}] | ||||
| 2023/12/25 08:31:09 removed second [rhn : Set{xhk, hfx}] | ||||
| 2023/12/25 08:31:09 >>>> starting new find cycle | ||||
| 2023/12/25 08:31:09 initial search from rhn and neighbors Set{xhk, hfx} | ||||
| 2023/12/25 08:31:09 initial dfs from rhn to hfx with initial visited Set{rhn} | ||||
| 2023/12/25 08:31:09 > step from rhn to hfx. visited : Set{rhn} | ||||
| 2023/12/25 08:31:09 > step from hfx to pzl. visited : Set{rhn, hfx} | ||||
| 2023/12/25 08:31:09 > step from pzl to rsh. visited : Set{rhn, hfx, pzl} | ||||
| 2023/12/25 08:31:09 > step from rsh to frs. visited : Set{hfx, pzl, rsh, rhn} | ||||
| 2023/12/25 08:31:09 > step from frs to qnr. visited : Set{rsh, frs, rhn, hfx, pzl} | ||||
| 2023/12/25 08:31:09 > step from qnr to cmg. visited : Set{rsh, frs, rhn, hfx, pzl, qnr} | ||||
| 2023/12/25 08:31:09 > step from cmg to qnr. visited : Set{hfx, pzl, qnr, cmg, rsh, frs, rhn} | ||||
| 2023/12/25 08:31:09 <<<< cycle true, from cmg to qnr | ||||
| 2023/12/25 08:31:09 entering remove edge for cmg and qnr | ||||
| 2023/12/25 08:31:09 before remove first [cmg : Set{qnr, nvd}] | ||||
| 2023/12/25 08:31:09 removed first [cmg : Set{nvd}] | ||||
| 2023/12/25 08:31:09 before remove second [cmg : Set{nvd}] | ||||
| 2023/12/25 08:31:09 removed second [qnr : Set{nvd, rzs, frs}] | ||||
| 2023/12/25 08:31:09 >>>> starting new find cycle | ||||
| 2023/12/25 08:31:09 initial search from lsr and neighbors Set{rsh, pzl, lhk, rzs, frs} | ||||
| 2023/12/25 08:31:09 initial dfs from lsr to frs with initial visited Set{lsr} | ||||
| 2023/12/25 08:31:09 > step from lsr to frs. visited : Set{lsr} | ||||
| 2023/12/25 08:31:09 > step from frs to rsh. visited : Set{lsr, frs} | ||||
| 2023/12/25 08:31:09 > step from rsh to frs. visited : Set{lsr, frs, rsh} | ||||
| 2023/12/25 08:31:09 <<<< cycle true, from rsh to frs | ||||
| 2023/12/25 08:31:09 entering remove edge for rsh and frs | ||||
| 2023/12/25 08:31:09 before remove first [rsh : Set{frs, pzl, lsr, rzs}] | ||||
| 2023/12/25 08:31:09 removed first [rsh : Set{rzs, pzl, lsr}] | ||||
| 2023/12/25 08:31:09 before remove second [rsh : Set{rzs, pzl, lsr}] | ||||
| 2023/12/25 08:31:09 removed second [frs : Set{qnr, lhk, lsr}] | ||||
| 2023/12/25 08:31:09 >>>> starting new find cycle | ||||
| 2023/12/25 08:31:09 initial search from rhn and neighbors Set{xhk, hfx} | ||||
| 2023/12/25 08:31:09 initial dfs from rhn to xhk with initial visited Set{rhn} | ||||
| 2023/12/25 08:31:09 > step from rhn to xhk. visited : Set{rhn} | ||||
| 2023/12/25 08:31:09 > step from xhk to hfx. visited : Set{rhn, xhk} | ||||
| 2023/12/25 08:31:09 > step from hfx to pzl. visited : Set{rhn, xhk, hfx} | ||||
| 2023/12/25 08:31:09 > step from pzl to rsh. visited : Set{rhn, xhk, hfx, pzl} | ||||
| 2023/12/25 08:31:09 > step from rsh to rzs. visited : Set{rhn, xhk, hfx, pzl, rsh} | ||||
| 2023/12/25 08:31:09 > step from rzs to rsh. visited : Set{rzs, rsh, rhn, xhk, hfx, pzl} | ||||
| 2023/12/25 08:31:09 <<<< cycle true, from rzs to rsh | ||||
| 2023/12/25 08:31:09 entering remove edge for rzs and rsh | ||||
| 2023/12/25 08:31:09 before remove first [rzs : Set{lsr, rsh, qnr}] | ||||
| 2023/12/25 08:31:09 removed first [rzs : Set{qnr, lsr}] | ||||
| 2023/12/25 08:31:09 before remove second [rzs : Set{lsr, qnr}] | ||||
| 2023/12/25 08:31:09 removed second [rsh : Set{pzl, lsr}] | ||||
| 2023/12/25 08:31:09 >>>> starting new find cycle | ||||
| 2023/12/25 08:31:09 initial search from xhk and neighbors Set{hfx, rhn, bvb, ntq} | ||||
| 2023/12/25 08:31:09 initial dfs from xhk to hfx with initial visited Set{xhk} | ||||
| 2023/12/25 08:31:09 > step from xhk to hfx. visited : Set{xhk} | ||||
| 2023/12/25 08:31:09 > step from hfx to pzl. visited : Set{xhk, hfx} | ||||
| 2023/12/25 08:31:09 > step from pzl to rsh. visited : Set{xhk, hfx, pzl} | ||||
| 2023/12/25 08:31:09 > step from rsh to pzl. visited : Set{pzl, xhk, hfx, rsh} | ||||
| 2023/12/25 08:31:09 <<<< cycle true, from rsh to pzl | ||||
| 2023/12/25 08:31:09 entering remove edge for rsh and pzl | ||||
| 2023/12/25 08:31:09 before remove first [rsh : Set{pzl, lsr}] | ||||
| 2023/12/25 08:31:09 removed first [rsh : Set{lsr}] | ||||
| 2023/12/25 08:31:09 before remove second [rsh : Set{lsr}] | ||||
| 2023/12/25 08:31:09 removed second [pzl : Set{lsr, hfx, nvd}] | ||||
| 2023/12/25 08:31:09 >>>> starting new find cycle | ||||
| 2023/12/25 08:31:09 initial search from rsh and neighbors Set{lsr} | ||||
| 2023/12/25 08:31:09 initial dfs from rsh to lsr with initial visited Set{rsh} | ||||
| 2023/12/25 08:31:09 > step from rsh to lsr. visited : Set{rsh} | ||||
| 2023/12/25 08:31:09 > step from lsr to frs. visited : Set{rsh, lsr} | ||||
| 2023/12/25 08:31:09 > step from frs to qnr. visited : Set{frs, lsr, rsh} | ||||
| 2023/12/25 08:31:09 > step from qnr to nvd. visited : Set{lsr, rsh, frs, qnr} | ||||
| 2023/12/25 08:31:09 > step from nvd to jqt. visited : Set{rsh, frs, qnr, nvd, lsr} | ||||
| 2023/12/25 08:31:09 > step from jqt to nvd. visited : Set{lsr, rsh, frs, qnr, nvd, jqt} | ||||
| 2023/12/25 08:31:09 <<<< cycle true, from jqt to nvd | ||||
| 2023/12/25 08:31:09 entering remove edge for jqt and nvd | ||||
| 2023/12/25 08:31:09 before remove first [jqt : Set{nvd}] | ||||
| 2023/12/25 08:31:09 removed first [jqt : Set{}] | ||||
| 2023/12/25 08:31:09 before remove second [jqt : Set{}] | ||||
| 2023/12/25 08:31:09 removed second [nvd : Set{cmg, pzl, qnr, lhk}] | ||||
| 2023/12/25 08:31:09 >>>> starting new find cycle | ||||
| 2023/12/25 08:31:09 initial search from bvb and neighbors Set{ntq, xhk} | ||||
| 2023/12/25 08:31:09 initial dfs from bvb to ntq with initial visited Set{bvb} | ||||
| 2023/12/25 08:31:09 > step from bvb to ntq. visited : Set{bvb} | ||||
| 2023/12/25 08:31:09 > step from ntq to xhk. visited : Set{bvb, ntq} | ||||
| 2023/12/25 08:31:09 > step from xhk to hfx. visited : Set{ntq, xhk, bvb} | ||||
| 2023/12/25 08:31:09 > step from hfx to pzl. visited : Set{bvb, ntq, xhk, hfx} | ||||
| 2023/12/25 08:31:09 > step from pzl to nvd. visited : Set{pzl, bvb, ntq, xhk, hfx} | ||||
| 2023/12/25 08:31:09 > step from nvd to qnr. visited : Set{hfx, pzl, nvd, bvb, ntq, xhk} | ||||
| 2023/12/25 08:31:09 > step from qnr to nvd. visited : Set{pzl, nvd, bvb, ntq, xhk, hfx, qnr} | ||||
| 2023/12/25 08:31:09 <<<< cycle true, from qnr to nvd | ||||
| 2023/12/25 08:31:09 entering remove edge for qnr and nvd | ||||
| 2023/12/25 08:31:09 before remove first [qnr : Set{nvd, rzs, frs}] | ||||
| 2023/12/25 08:31:09 removed first [qnr : Set{rzs, frs}] | ||||
| 2023/12/25 08:31:09 before remove second [qnr : Set{frs, rzs}] | ||||
| 2023/12/25 08:31:09 removed second [nvd : Set{pzl, lhk, cmg}] | ||||
| 2023/12/25 08:31:09 >>>> starting new find cycle | ||||
| 2023/12/25 08:31:09 initial search from pzl and neighbors Set{lsr, hfx, nvd} | ||||
| 2023/12/25 08:31:09 initial dfs from pzl to lsr with initial visited Set{pzl} | ||||
| 2023/12/25 08:31:09 > step from pzl to lsr. visited : Set{pzl} | ||||
| 2023/12/25 08:31:09 > step from lsr to rsh. visited : Set{pzl, lsr} | ||||
| 2023/12/25 08:31:09 > step from rsh to lsr. visited : Set{pzl, lsr, rsh} | ||||
| 2023/12/25 08:31:09 <<<< cycle true, from rsh to lsr | ||||
| 2023/12/25 08:31:09 entering remove edge for rsh and lsr | ||||
| 2023/12/25 08:31:09 before remove first [rsh : Set{lsr}] | ||||
| 2023/12/25 08:31:09 removed first [rsh : Set{}] | ||||
| 2023/12/25 08:31:09 before remove second [rsh : Set{}] | ||||
| 2023/12/25 08:31:09 removed second [lsr : Set{rzs, frs, pzl, lhk}] | ||||
| 2023/12/25 08:31:09 >>>> starting new find cycle | ||||
| 2023/12/25 08:31:09 initial search from rhn and neighbors Set{xhk, hfx} | ||||
| 2023/12/25 08:31:09 initial dfs from rhn to xhk with initial visited Set{rhn} | ||||
| 2023/12/25 08:31:09 > step from rhn to xhk. visited : Set{rhn} | ||||
| 2023/12/25 08:31:09 > step from xhk to hfx. visited : Set{rhn, xhk} | ||||
| 2023/12/25 08:31:09 > step from hfx to pzl. visited : Set{hfx, rhn, xhk} | ||||
| 2023/12/25 08:31:09 > step from pzl to lsr. visited : Set{rhn, xhk, hfx, pzl} | ||||
| 2023/12/25 08:31:09 > step from lsr to frs. visited : Set{xhk, hfx, pzl, rhn, lsr} | ||||
| 2023/12/25 08:31:09 > step from frs to qnr. visited : Set{rhn, lsr, xhk, hfx, pzl, frs} | ||||
| 2023/12/25 08:31:09 > step from qnr to rzs. visited : Set{qnr, rhn, lsr, xhk, hfx, pzl, frs} | ||||
| 2023/12/25 08:31:09 > step from rzs to lsr. visited : Set{hfx, rzs, pzl, frs, qnr, rhn, lsr, xhk} | ||||
| 2023/12/25 08:31:09 <<<< cycle true, from rzs to lsr | ||||
| 2023/12/25 08:31:09 entering remove edge for rzs and lsr | ||||
| 2023/12/25 08:31:09 before remove first [rzs : Set{lsr, qnr}] | ||||
| 2023/12/25 08:31:09 removed first [rzs : Set{qnr}] | ||||
| 2023/12/25 08:31:09 before remove second [rzs : Set{qnr}] | ||||
| 2023/12/25 08:31:09 removed second [lsr : Set{lhk, frs, pzl}] | ||||
| 2023/12/25 08:31:09 >>>> starting new find cycle | ||||
| 2023/12/25 08:31:09 initial search from frs and neighbors Set{qnr, lhk, lsr} | ||||
| 2023/12/25 08:31:09 initial dfs from frs to qnr with initial visited Set{frs} | ||||
| 2023/12/25 08:31:09 > step from frs to qnr. visited : Set{frs} | ||||
| 2023/12/25 08:31:09 > step from qnr to rzs. visited : Set{frs, qnr} | ||||
| 2023/12/25 08:31:09 > step from rzs to qnr. visited : Set{frs, qnr, rzs} | ||||
| 2023/12/25 08:31:09 <<<< cycle true, from rzs to qnr | ||||
| 2023/12/25 08:31:09 entering remove edge for rzs and qnr | ||||
| 2023/12/25 08:31:09 before remove first [rzs : Set{qnr}] | ||||
| 2023/12/25 08:31:09 removed first [rzs : Set{}] | ||||
| 2023/12/25 08:31:09 before remove second [rzs : Set{}] | ||||
| 2023/12/25 08:31:09 removed second [qnr : Set{frs}] | ||||
| 2023/12/25 08:31:09 >>>> starting new find cycle | ||||
| 2023/12/25 08:31:09 initial search from frs and neighbors Set{qnr, lhk, lsr} | ||||
| 2023/12/25 08:31:09 initial dfs from frs to qnr with initial visited Set{frs} | ||||
| 2023/12/25 08:31:09 > step from frs to qnr. visited : Set{frs} | ||||
| 2023/12/25 08:31:09 > step from qnr to frs. visited : Set{frs, qnr} | ||||
| 2023/12/25 08:31:09 <<<< cycle true, from qnr to frs | ||||
| 2023/12/25 08:31:09 entering remove edge for qnr and frs | ||||
| 2023/12/25 08:31:09 before remove first [qnr : Set{frs}] | ||||
| 2023/12/25 08:31:09 removed first [qnr : Set{}] | ||||
| 2023/12/25 08:31:09 before remove second [qnr : Set{}] | ||||
| 2023/12/25 08:31:09 removed second [frs : Set{lsr, lhk}] | ||||
| 2023/12/25 08:31:09 >>>> starting new find cycle | ||||
| 2023/12/25 08:31:09 initial search from frs and neighbors Set{lsr, lhk} | ||||
| 2023/12/25 08:31:09 initial dfs from frs to lhk with initial visited Set{frs} | ||||
| 2023/12/25 08:31:09 > step from frs to lhk. visited : Set{frs} | ||||
| 2023/12/25 08:31:09 > step from lhk to nvd. visited : Set{frs, lhk} | ||||
| 2023/12/25 08:31:09 > step from nvd to cmg. visited : Set{lhk, nvd, frs} | ||||
| 2023/12/25 08:31:09 > step from cmg to nvd. visited : Set{nvd, cmg, frs, lhk} | ||||
| 2023/12/25 08:31:09 <<<< cycle true, from cmg to nvd | ||||
| 2023/12/25 08:31:09 entering remove edge for cmg and nvd | ||||
| 2023/12/25 08:31:09 before remove first [cmg : Set{nvd}] | ||||
| 2023/12/25 08:31:09 removed first [cmg : Set{}] | ||||
| 2023/12/25 08:31:09 before remove second [cmg : Set{}] | ||||
| 2023/12/25 08:31:09 removed second [nvd : Set{pzl, lhk}] | ||||
| 2023/12/25 08:31:09 >>>> starting new find cycle | ||||
| 2023/12/25 08:31:09 initial search from cmg and neighbors Set{} | ||||
| 2023/12/25 08:31:09 <<<< cycle false, from  to | ||||
|     graph_test.go:57: removed edges Set{{frs qnr}, {cmg lhk}, {bvb cmg}, {bvb rhn}, {lsr rzs}, {jqt nvd}, {nvd qnr}, {cmg nvd}, {jqt rhn}, {cmg rzs}, {frs rsh}, {rsh rzs}, {jqt ntq}, {cmg qnr}, {lsr rsh}, {jqt xhk}, {bvb hfx}, {pzl rsh}, {qnr rzs}} | ||||
|     graph_test.go:58: after removal graph is {Nodes:map[bvb:[bvb : Set{ntq, xhk}] cmg:[cmg : Set{}] frs:[frs : Set{lhk, lsr}] hfx:[hfx : Set{rhn, pzl, ntq, xhk}] jqt:[jqt : Set{}] lhk:[lhk : Set{nvd, lsr, frs}] lsr:[lsr : Set{frs, pzl, lhk}] ntq:[ntq : Set{bvb, xhk, hfx}] nvd:[nvd : Set{pzl, lhk}] pzl:[pzl : Set{lsr, hfx, nvd}] qnr:[qnr : Set{}] rhn:[rhn : Set{xhk, hfx}] rsh:[rsh : Set{}] rzs:[rzs : Set{}] xhk:[xhk : Set{ntq, hfx, rhn, bvb}]]} | ||||
| --- PASS: TestRemoveAllCycles (0.00s) | ||||
| PASS | ||||
| ok  	sunshine.industries/aoc2023/day25	0.003s | ||||
| 
 | ||||
| #+end_src | ||||
| ** kind of bruteforce | ||||
|     graph_test.go:93: hopefully as answer: 0 | ||||
|     graph_test.go:93: hopefully as answer: 0 | ||||
|     graph_test.go:93: hopefully as answer: 0 | ||||
|     graph_test.go:93: hopefully as answer: 0 | ||||
|     graph_test.go:93: hopefully as answer: 0 | ||||
|     graph_test.go:93: hopefully as answer: 0 | ||||
|     graph_test.go:93: hopefully as answer: 0 | ||||
|     graph_test.go:93: hopefully as answer: 0 | ||||
|     graph_test.go:93: hopefully as answer: 0 | ||||
|     graph_test.go:93: hopefully as answer: 0 | ||||
|     graph_test.go:93: hopefully as answer: 0 | ||||
|     graph_test.go:93: hopefully as answer: 0 | ||||
|     graph_test.go:93: hopefully as answer: 0 | ||||
|     graph_test.go:93: hopefully as answer: 0 | ||||
|     graph_test.go:93: hopefully as answer: 0 | ||||
|     graph_test.go:93: hopefully as answer: 0 | ||||
|     graph_test.go:93: hopefully as answer: 0 | ||||
|     graph_test.go:93: hopefully as answer: 518391 | ||||
|     graph_test.go:93: hopefully as answer: 0 | ||||
|     graph_test.go:93: hopefully as answer: 518391 | ||||
|     graph_test.go:93: hopefully as answer: 0 | ||||
							
								
								
									
										6
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								main.go
									
									
									
									
									
								
							| @ -4,15 +4,15 @@ import ( | ||||
| 	"log" | ||||
| 	"time" | ||||
| 
 | ||||
| 	"sunshine.industries/aoc2023/day24" | ||||
| 	"sunshine.industries/aoc2023/day25" | ||||
| ) | ||||
| 
 | ||||
| func main() { | ||||
| 	startTime := time.Now() | ||||
| 	log.Print("> starting run:") | ||||
| 
 | ||||
| 	result := day24.Run() | ||||
| 	log.Printf("\n\nday24 result: %d\n****\n", result) | ||||
| 	result := day25.Run() | ||||
| 	log.Printf("\n\nday25 result: %d\n****\n", result) | ||||
| 	endTime := time.Now() | ||||
| 	diff := endTime.Sub(startTime) | ||||
| 	log.Printf("execution took %s", diff.String()) | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user