graph

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2019 License: Apache-2.0 Imports: 1 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 {
	// Edges in order of appearance (for deterministic order after sort).
	OutgoingEdges []V
	// Edges in the inverse of outgoing, i.e. vertices that depend on this vertex
	IncomingEdges []V
	Data          D
}

Vertex is a resource representation in a dependency graph.

Jump to

Keyboard shortcuts

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