dag

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2019 License: GPL-3.0 Imports: 3 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
}

func NewDAG

func NewDAG(rootVertex ...*Vertex) (*DAG, error)

NewDAG

func (*DAG) AddVertex

func (d *DAG) AddVertex(vertex *Vertex) error

AddVertex

func (*DAG) DelVertex

func (d *DAG) DelVertex(id interface{}) error

DelVertex

func (DAG) GetIDs

func (d DAG) GetIDs() []interface{}

func (DAG) GetMaxParentsCount

func (d DAG) GetMaxParentsCount() int

GetMaxParentsCount

func (*DAG) GetVertex

func (d *DAG) GetVertex(id interface{}) *Vertex

func (*DAG) SetMaxParentsCount

func (d *DAG) SetMaxParentsCount(maxCount int)

SetMaxParentsCount

func (DAG) String

func (d DAG) String() string

type Vertex

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

func NewVertex

func NewVertex(id interface{}, value interface{}, parents ...interface{}) (*Vertex, error)

NewVertex create vertex, id, value and parents must be set and is immutable parents cloud be Vertex or just key

func (*Vertex) AddChild

func (v *Vertex) AddChild(children ...interface{})

AddChild just add the child for this vertex (usually the key or point of child object) not add this vertex as parent of the child vertex or check their parents at the same time

func (Vertex) Children

func (v Vertex) Children() []interface{}

func (*Vertex) DelChild

func (v *Vertex) DelChild(children ...interface{})

func (Vertex) HasChild

func (v Vertex) HasChild(item interface{}) bool

func (Vertex) HasParent

func (v Vertex) HasParent(item interface{}) bool

func (Vertex) ID

func (v Vertex) ID() interface{}

func (Vertex) Parents

func (v Vertex) Parents() []interface{}

func (*Vertex) SetValue

func (v *Vertex) SetValue(value interface{})

func (Vertex) String

func (v Vertex) String() string

func (Vertex) Value

func (v Vertex) Value() interface{}

Jump to

Keyboard shortcuts

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