graph

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNilGraph          = errors.New("cannot operate on nil-graph")
	ErrNilNode           = errors.New("cannot operate on nil-node")
	ErrNodeAlreadyExists = errors.New("node with identical hash already exists in graph")
	ErrNodeNotFound      = errors.New("node not found")
	ErrEdgeSelf          = errors.New("self-edges are not allowed")
	ErrEdgeCrossLevel    = errors.New("edges not allowed between nodes of different hierarchical levels")
)

Functions

This section is empty.

Types

type HierarchicalDigraph

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

func NewHierarchicalDigraph

func NewHierarchicalDigraph(log *logger.Logger) *HierarchicalDigraph

func (*HierarchicalDigraph) AddEdge

func (g *HierarchicalDigraph) AddEdge(src Node, dst Node) error

func (*HierarchicalDigraph) AddNode

func (g *HierarchicalDigraph) AddNode(node Node) error

func (*HierarchicalDigraph) DeleteEdge

func (g *HierarchicalDigraph) DeleteEdge(src Node, dst Node) error

func (*HierarchicalDigraph) DeleteNode

func (g *HierarchicalDigraph) DeleteNode(hash string) error

func (HierarchicalDigraph) GetLevel

func (g HierarchicalDigraph) GetLevel(level int) NodeRefs

func (HierarchicalDigraph) GetNode

func (g HierarchicalDigraph) GetNode(hash string) (Node, error)

type Node

type Node interface {
	Name() string
	Hash() string
	String() string

	Predecessors() *NodeRefs
	Successors() *NodeRefs

	Parent() Node
	Children() *NodeRefs
}

type NodeRefs

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

func NewNodeRefs

func NewNodeRefs() NodeRefs

func (*NodeRefs) Add

func (n *NodeRefs) Add(node Node)

func (*NodeRefs) Delete

func (n *NodeRefs) Delete(hash string)

func (NodeRefs) Get

func (n NodeRefs) Get(hash string) (Node, int)

func (NodeRefs) Len

func (n NodeRefs) Len() int

func (NodeRefs) List

func (n NodeRefs) List() []Node

func (NodeRefs) String

func (n NodeRefs) String() string

func (*NodeRefs) Wipe

func (n *NodeRefs) Wipe(hash string)

Jump to

Keyboard shortcuts

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