dag

package
v0.0.0-...-2bc610f Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2017 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 Digraph

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

Digraph represents a directed graph

func New

func New(v int) (*Digraph, error)

New initializes a directed graph

func (*Digraph) AddVertex

func (d *Digraph) AddVertex(v Vertex) error

AddVertex adds new vertex

func (*Digraph) CheckCircle

func (d *Digraph) CheckCircle() bool

CheckCircle return true if circle is found in the graph

func (*Digraph) CirclePath

func (d *Digraph) CirclePath() string

CirclePath returns the circle or empty string if it is not found

func (*Digraph) E

func (d *Digraph) E() int

E returns number of edges

func (*Digraph) String

func (d *Digraph) String() string

String inspects graph

func (*Digraph) TopologicalOrder

func (d *Digraph) TopologicalOrder() []Vertex

TopologicalOrder returns vertices in topological order

func (*Digraph) V

func (d *Digraph) V() int

V returns number of vertices

func (*Digraph) Vertex

func (d *Digraph) Vertex(id ID) Vertex

Vertex fetches the vertex by id

func (*Digraph) Vertices

func (d *Digraph) Vertices() []Vertex

Vertices return all vertices

type ID

type ID string

ID represents node id

type Vertex

type Vertex struct {
	ID   ID
	Next []ID
}

Vertex holds it's id and id of next vertex if it has

func NewVertex

func NewVertex(id ID, next []ID) (Vertex, error)

NewVertex creates a vertex

Jump to

Keyboard shortcuts

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