day25: cleanup
This commit is contained in:
parent
9177d35caf
commit
dce2d06602
@ -137,30 +137,6 @@ func (g *Graph) dfcCycle(fromName, atName string, visited mapset.Set[string]) (c
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *Graph) DoThreeRemovals() {
|
|
||||||
from, to, found := g.findCycle()
|
|
||||||
log.Printf("first result %s, %s, %t", from, to, found)
|
|
||||||
// graph_test.go:26: first result xhk, rhn, true
|
|
||||||
g.RemoveEdge("xhk", "rhn")
|
|
||||||
|
|
||||||
from, to, found = g.findCycle()
|
|
||||||
log.Printf("second result %s, %s, %t", from, to, found)
|
|
||||||
// graph_test.go:32: second result qnr, nvd, true
|
|
||||||
g.RemoveEdge("qnr", "nvd")
|
|
||||||
|
|
||||||
from, to, found = g.findCycle()
|
|
||||||
log.Printf("third result %s, %s, %t", from, to, found)
|
|
||||||
// graph_test.go:36: third result lhk, cmg, true
|
|
||||||
|
|
||||||
g.RemoveEdge("lhk", "cmg")
|
|
||||||
from, to, found = g.findCycle()
|
|
||||||
log.Printf("fourth result %s, %s, %t", from, to, found)
|
|
||||||
|
|
||||||
// OK, so there could be more than 3 cycles.
|
|
||||||
// but if i want to break things into 2 components, i need to do more investigating
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (g *Graph) ComponentFrom(fromName string) (component mapset.Set[string]) {
|
func (g *Graph) ComponentFrom(fromName string) (component mapset.Set[string]) {
|
||||||
startNode := g.Nodes[fromName]
|
startNode := g.Nodes[fromName]
|
||||||
component = mapset.NewSet[string](startNode.Name)
|
component = mapset.NewSet[string](startNode.Name)
|
||||||
|
@ -19,12 +19,6 @@ func TestRemoveEdge(t *testing.T) {
|
|||||||
t.Logf("after removing bvb-hfv %+v", g)
|
t.Logf("after removing bvb-hfv %+v", g)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRunFindCycle(t *testing.T) {
|
|
||||||
filename := "example"
|
|
||||||
g := ReadGraphFile(filename)
|
|
||||||
g.DoThreeRemovals()
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestCreateExampleMermaid(t *testing.T) {
|
func TestCreateExampleMermaid(t *testing.T) {
|
||||||
filename := "example"
|
filename := "example"
|
||||||
g := ReadGraphFile(filename)
|
g := ReadGraphFile(filename)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user