github.com/vtorhonen/terraform@v0.9.0-beta2.0.20170307220345-5d894e4ffda7/digraph/digraph.go (about) 1 package digraph 2 3 // Digraph is used to represent a Directed Graph. This means 4 // we have a set of nodes, and a set of edges which are directed 5 // from a source and towards a destination 6 type Digraph interface { 7 // Nodes provides all the nodes in the graph 8 Nodes() []Node 9 10 // Sources provides all the source nodes in the graph 11 Sources() []Node 12 13 // Sinks provides all the sink nodes in the graph 14 Sinks() []Node 15 16 // Transpose reverses the edge directions and returns 17 // a new Digraph 18 Transpose() Digraph 19 } 20 21 // Node represents a vertex in a Digraph 22 type Node interface { 23 // Edges returns the out edges for a given nod 24 Edges() []Edge 25 } 26 27 // Edge represents a directed edge in a Digraph 28 type Edge interface { 29 // Head returns the start point of the Edge 30 Head() Node 31 32 // Tail returns the end point of the Edge 33 Tail() Node 34 }