dag

package
v1.3.9-279552a1d4fd1f5... Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2017 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DAG

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

DAG represents a directected acyclic graph

func NewDAG

func NewDAG(nodes map[string][]string) *DAG

NewDAG creates a DAG and populates it with the given nodes.

func (*DAG) Ancestors

func (d *DAG) Ancestors(id string, from []string) []string

Ancestors returns a slice containing all ancestors of a node, 'id', in d which are a descendant of at least one of the nodes in 'from'.

func (*DAG) Descendants

func (d *DAG) Descendants(id string, to []string) []string

Descendants returns a slice containing all descendants of a node, 'id', in d which are an ancestor of at least one of the nodes in 'to'.

func (*DAG) Ghosts

func (d *DAG) Ghosts() []string

Ghosts returns nodes that were referenced as parents but never created.

func (*DAG) Leaves

func (d *DAG) Leaves() []string

Leaves returns a slice containing all leaves in d.

func (*DAG) NewNode

func (d *DAG) NewNode(id string, parents []string)

NewNode adds a node to d.

func (*DAG) Sorted

func (d *DAG) Sorted() []string

Sorted returns all nodes in a topologically sorted order

Jump to

Keyboard shortcuts

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