graph

package
v1.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 16, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package graph provides tool to detect circular dependencies and find all dependant nodes in graphs.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() *graph
Example (CircularDeps)
package main

import (
	"fmt"

	"github.com/gontainer/gontainer-helpers/graph"
)

func main() {
	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]]
Example (Deps)
package main

import (
	"fmt"

	"github.com/gontainer/gontainer-helpers/graph"
)

func main() {
	g := graph.New()
	g.AddDep("company", "tech-team")
	g.AddDep("tech-team", "cto")

	fmt.Println(g.Deps("company"))

}
Output:

[cto tech-team]

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL