topo

package
v12.3.5 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSelfReferential  = errors.New("self-referential dependencies not allowed")
	ErrConflictingAlias = errors.New("alias already defined")
	ErrCircular         = errors.New("circular dependencies not allowed")
)

Functions

This section is empty.

Types

type CheckFn

type CheckFn[T comparable, V any] func(T, V) error

type DepMap

type DepMap[T comparable] map[T]NodeSet[T]

type DependencyInfo

type DependencyInfo[T comparable] struct {
	Provider T
	alpm.Depend
}

type Graph

type Graph[T comparable, V any] struct {
	// contains filtered or unexported fields
}

func New

func New[T comparable, V any]() *Graph[T, V]

func (*Graph[T, V]) AddNode

func (g *Graph[T, V]) AddNode(node T)

func (*Graph[T, V]) DependOn

func (g *Graph[T, V]) DependOn(child, parent T) error

func (*Graph[T, V]) Dependencies

func (g *Graph[T, V]) Dependencies(child T) NodeSet[T]

func (*Graph[T, V]) Dependents

func (g *Graph[T, V]) Dependents(parent T) NodeSet[T]

func (*Graph[T, V]) DependsOn

func (g *Graph[T, V]) DependsOn(child, parent T) bool

func (*Graph[T, V]) Exists

func (g *Graph[T, V]) Exists(node T) bool

func (*Graph[T, V]) ForEach

func (g *Graph[T, V]) ForEach(f CheckFn[T, V]) error

func (*Graph[T, V]) GetNodeInfo

func (g *Graph[T, V]) GetNodeInfo(node T) *NodeInfo[V]

func (*Graph[T, V]) GetProviderNode

func (g *Graph[T, V]) GetProviderNode(provides T) *DependencyInfo[T]

func (*Graph[T, V]) HasDependent

func (g *Graph[T, V]) HasDependent(parent, child T) bool

func (*Graph[T, V]) ImmediateDependencies

func (g *Graph[T, V]) ImmediateDependencies(node T) NodeSet[T]

func (*Graph[T, V]) Len

func (g *Graph[T, V]) Len() int

func (*Graph[T, V]) Provides

func (g *Graph[T, V]) Provides(provides T, depInfo *alpm.Depend, node T)

func (*Graph[T, V]) ProvidesExists

func (g *Graph[T, V]) ProvidesExists(provides T) bool

func (*Graph[T, V]) Prune

func (g *Graph[T, V]) Prune(node T) []T

Prune removes the node, its dependencies if there are no other dependents and its dependents

func (*Graph[T, V]) SetNodeInfo

func (g *Graph[T, V]) SetNodeInfo(node T, nodeInfo *NodeInfo[V])

func (*Graph[T, V]) String

func (g *Graph[T, V]) String() string

func (*Graph[T, V]) TopoSortedLayerMap

func (g *Graph[T, V]) TopoSortedLayerMap(checkFn CheckFn[T, V]) []map[T]V

TopoSortedLayerMap returns a slice of all of the graph nodes in topological sort order with their node info.

type NodeInfo

type NodeInfo[V any] struct {
	Color      string
	Background string
	Value      V
}

type NodeSet

type NodeSet[T comparable] map[T]bool

func (NodeSet[T]) Slice

func (n NodeSet[T]) Slice() []T

type ProvidesMap

type ProvidesMap[T comparable] map[T]*DependencyInfo[T]

Jump to

Keyboard shortcuts

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