https://github.com/gontainer/graph
Detect circular dependencies in graphs.
https://github.com/gontainer/graph
circular-dependencies circular-dependency directed-graph directed-graphs graph graphs
Last synced: 3 months ago
JSON representation
Detect circular dependencies in graphs.
- Host: GitHub
- URL: https://github.com/gontainer/graph
- Owner: gontainer
- License: mit
- Created: 2024-02-28T21:58:44.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-28T22:32:37.000Z (over 1 year ago)
- Last Synced: 2025-01-20T06:14:31.965Z (5 months ago)
- Topics: circular-dependencies, circular-dependency, directed-graph, directed-graphs, graph, graphs
- Language: Go
- Homepage:
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://pkg.go.dev/github.com/gontainer/graph)
[](https://github.com/gontainer/graph/actions/workflows/tests.yml)
[](https://coveralls.io/github/gontainer/graph?branch=main)
[](https://goreportcard.com/report/github.com/gontainer/graph)
[](https://sonarcloud.io/summary/new_code?id=gontainer_graph)# Graph
This package provides a tool to detect circular dependencies and find all dependant nodes in directed graphs.
```go
g := graph.New()
g.AddDep("company", "tech-team")
g.AddDep("tech-team", "cto")
g.AddDep("cto", "company")
g.AddDep("cto", "ceo")
g.AddDep("ceo", "company")fmt.Println(g.CircularDeps())
// Output:
// [[company tech-team cto company] [company tech-team cto ceo company]]
```See [examples](examples_test.go).