File: digraph.go

package info (click to toggle)
goiardi 0.11.10-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,708 kB
  • sloc: sql: 4,994; makefile: 156; sh: 95; python: 30
file content (34 lines) | stat: -rw-r--r-- 830 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package digraph

// Digraph is used to represent a Directed Graph. This means
// we have a set of nodes, and a set of edges which are directed
// from a source and towards a destination
type Digraph interface {
	// Nodes provides all the nodes in the graph
	Nodes() []Node

	// Sources provides all the source nodes in the graph
	Sources() []Node

	// Sinks provides all the sink nodes in the graph
	Sinks() []Node

	// Transpose reverses the edge directions and returns
	// a new Digraph
	Transpose() Digraph
}

// Node represents a vertex in a Digraph
type Node interface {
	// Edges returns the out edges for a given nod
	Edges() []Edge
}

// Edge represents a directed edge in a Digraph
type Edge interface {
	// Head returns the start point of the Edge
	Head() Node

	// Tail returns the end point of the Edge
	Tail() Node
}