graph

package
v0.19.2 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cycle added in v0.17.4

type Cycle struct {
	Cause [2]string
	Stack []string
}

type Edge added in v0.17.4

type Edge[T any] struct {
	// contains filtered or unexported fields
}

func (*Edge[T]) From added in v0.17.4

func (e *Edge[T]) From() graph.Node

func (*Edge[T]) ReversedEdge added in v0.17.4

func (e *Edge[T]) ReversedEdge() graph.Edge

func (*Edge[T]) To added in v0.17.4

func (e *Edge[T]) To() graph.Node

type Graph

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

func MakeTestGraph added in v0.17.4

func MakeTestGraph(spec map[int][]int) *Graph[int]

func NewGraph

func NewGraph[T any]() *Graph[T]

func (*Graph[T]) AddFromToEdge added in v0.17.4

func (g *Graph[T]) AddFromToEdge(fromId string, toIds ...string) error

func (*Graph[T]) AddNode

func (g *Graph[T]) AddNode(node *Node[T])

func (*Graph[T]) AllNodes added in v0.17.4

func (g *Graph[T]) AllNodes() []*Node[T]

func (*Graph[T]) Edge added in v0.17.4

func (g *Graph[T]) Edge(uid, vid int64) graph.Edge

func (*Graph[T]) From added in v0.17.4

func (g *Graph[T]) From(id int64) graph.Nodes

func (*Graph[T]) FromId added in v0.17.4

func (g *Graph[T]) FromId(id string) []*Node[T]

FromId returns the nodes to which id can reach.

func (*Graph[T]) Get

func (g *Graph[T]) Get(id string) *Node[T]

func (*Graph[T]) GetNodesWithoutParents added in v0.19.0

func (g *Graph[T]) GetNodesWithoutParents() []*Node[T]

func (*Graph[T]) Has

func (g *Graph[T]) Has(nodeId string) bool

func (*Graph[T]) HasEdgeBetween added in v0.17.4

func (g *Graph[T]) HasEdgeBetween(xid, yid int64) bool

func (*Graph[T]) HasEdgeFromTo added in v0.17.4

func (g *Graph[T]) HasEdgeFromTo(uid, vid int64) bool

func (*Graph[T]) Node added in v0.17.4

func (g *Graph[T]) Node(id int64) graph.Node

func (*Graph[T]) Nodes

func (g *Graph[T]) Nodes() graph.Nodes

func (*Graph[T]) RemoveCycles added in v0.17.4

func (g *Graph[T]) RemoveCycles(node *Node[T]) []Cycle

func (*Graph[T]) RemoveFromToEdge added in v0.17.4

func (g *Graph[T]) RemoveFromToEdge(fromId string, toId string)

func (*Graph[T]) RemoveJohnsonCycles added in v0.19.0

func (g *Graph[T]) RemoveJohnsonCycles() []Cycle

func (*Graph[T]) To added in v0.17.4

func (g *Graph[T]) To(id int64) graph.Nodes

func (*Graph[T]) ToId added in v0.17.4

func (g *Graph[T]) ToId(id string) []*Node[T]

ToId returns the nodes from which id is reachable.

type Node

type Node[T any] struct {
	// Id identifies the node with a string. This is typically the absolute path
	//  of a file in dep-tree.
	Id string
	// Errors This node might hold some errors that are worth rendering to the user.
	//  For example, if the node is a file, maybe it failed to be parsed.
	Errors []error
	// Data is a generic implementation-defined data bucket. Implementations can put
	//  whatever they want here.
	Data T
}

func MakeNode

func MakeNode[T any](id string, data T) *Node[T]

func (*Node[T]) AddErrors

func (n *Node[T]) AddErrors(err ...error)

func (*Node[T]) ID added in v0.17.4

func (n *Node[T]) ID() int64

type Nodes added in v0.17.4

type Nodes[T any] struct {
	// contains filtered or unexported fields
}

func NewNodesIterator added in v0.17.4

func NewNodesIterator[T any](nodes []*Node[T]) *Nodes[T]

func (*Nodes[T]) Len added in v0.17.4

func (n *Nodes[T]) Len() int

func (*Nodes[T]) Next added in v0.17.4

func (n *Nodes[T]) Next() bool

func (*Nodes[T]) Node added in v0.17.4

func (n *Nodes[T]) Node() graph.Node

func (*Nodes[T]) Reset added in v0.17.4

func (n *Nodes[T]) Reset()

Jump to

Keyboard shortcuts

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