Skip to content

Commit

Permalink
EL-002(feat): sorted cycle. (#7)
Browse files Browse the repository at this point in the history
Co-authored-by: yuanyou <yuanyou@kezaihui.com>
  • Loading branch information
elza2 and yuanyou authored Sep 12, 2023
1 parent fe500dd commit 80a4ef3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/detector.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"os"
"path/filepath"
"regexp"
"sort"
"strings"

"github.com/fatih/color"
Expand Down Expand Up @@ -358,6 +359,9 @@ func (c *CyclicDetector) QueryCycleNodes(
}

func PrintCycle(cycle []string) {
sort.Slice(cycle, func(i, j int) bool {
return cycle[i] > cycle[j]
})
downMark, vertical, startPre, endPre := "↓", "┆", "┌---→", "└--- "
output := make([]string, 0)
length := -1
Expand Down

0 comments on commit 80a4ef3

Please sign in to comment.