don't pass wg to next

This commit is contained in:
onyx-and-iris 2024-12-23 20:02:00 +00:00
parent ef120d05d4
commit 1f033ea3a0

View File

@ -39,7 +39,7 @@ func Solve(buf []byte) (string, error) {
wg.Add(1) wg.Add(1)
go func() { go func() {
defer wg.Done() defer wg.Done()
next([]string{}, nodes, set.New(), cliquesChan, networks, &wg) next([]string{}, nodes, set.New(), cliquesChan, networks)
}() }()
go func() { go func() {
@ -65,7 +65,6 @@ func next(
P, X *set.Set, P, X *set.Set,
cliquesChan chan<- clique, cliquesChan chan<- clique,
networks map[string]*set.Set, networks map[string]*set.Set,
wg *sync.WaitGroup,
) { ) {
if P.Size() == 0 && X.Size() == 0 { if P.Size() == 0 && X.Size() == 0 {
cliquesChan <- clique{slices.Clone(R)} cliquesChan <- clique{slices.Clone(R)}
@ -75,7 +74,7 @@ func next(
for _, v := range P.List() { for _, v := range P.List() {
nextR := append(R, v) nextR := append(R, v)
next(nextR, P.Intersection(networks[v]), X.Intersection(networks[v]), cliquesChan, networks, wg) next(nextR, P.Intersection(networks[v]), X.Intersection(networks[v]), cliquesChan, networks)
P.Remove(v) P.Remove(v)
X.Add(v) X.Add(v)