graph

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2017 License: Apache-2.0 Imports: 1 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type D

type D interface{}

D is data attached to the vertex.

type Graph

type Graph struct {
	// Vertices is a map from resource name to resource vertex.
	Vertices map[V]Vertex
	// contains filtered or unexported fields
}

Graph is a graph representation of resource dependencies.

func NewGraph

func NewGraph(size int) *Graph

func (*Graph) AddEdge

func (g *Graph) AddEdge(from, to V) error

func (*Graph) AddVertex

func (g *Graph) AddVertex(name V, data D)

func (*Graph) ContainsVertex

func (g *Graph) ContainsVertex(name V) bool

func (*Graph) TopologicalSort

func (g *Graph) TopologicalSort() ([]V, error)

type V

type V interface{}

V is name of the vertex.

type Vertex

type Vertex struct {
	EdgesSet map[V]struct{}
	Data     D
}

Vertex is a resource representation in a dependency graph.

func (Vertex) Edges

func (v Vertex) Edges() []V

Edges returns a list of resources current resource depends on.

Jump to

Keyboard shortcuts

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