import (
"fmt"
"github.com/chasestarr/scc"
"github.com/chasestarr/scc/graph"
)
func main() {
g := graph.New()
g.AddNode(1)
g.AddNode(2)
g.AddNode(3)
g.AddNode(4)
g.AddNode(5)
g.AddEdge(2, 1)
g.AddEdge(1, 3)
g.AddEdge(3, 2)
g.AddEdge(1, 4)
g.AddEdge(4, 5)
sscs := scc.Search(g)
fmt.Println(len(sccs)) // 3
}
-
Notifications
You must be signed in to change notification settings - Fork 0
chasestarr/scc
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
scc function returns an array of leader nodes with graph
Topics
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published