depgraph

package
v0.0.0-...-feddbd9 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Graph

type Graph struct {
	// contains filtered or unexported fields
}

Graph is a collection of nodes

func NewDepgraph

func NewDepgraph() *Graph

func (*Graph) Add

func (g *Graph) Add(target *Node)

Add places a Node into the current Graph

func (*Graph) Contains

func (g *Graph) Contains(target *Node) bool

Contains returns true if the target Node is found in its list

func (*Graph) Nodes

func (g *Graph) Nodes() []*Node

Nodes returns the nodes within the graph

func (*Graph) Remove

func (g *Graph) Remove(target *Node)

Remove deletes a target Node reference from the list of nodes in the graph

func (*Graph) Resolve

func (g *Graph) Resolve() []string

Resolve retruns a list of node names in order of their dependencies. A use case may be for determining the correct order to install software packages, or to start services. Based upon the algorithm described by Ferry Boender in the following article https://www.electricmonk.nl/log/2008/08/07/dependency-resolving-algorithm/

type Node

type Node struct {
	Name  string
	Edges []*Node
}

Node represents a node in a Graph with 0 to many edges

Jump to

Keyboard shortcuts

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