Documentation ¶
Overview ¶
Package graph contains type definitions for graphs and algorithms that operate on them.
This package is used in service maps logic.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrGraphNotSortable = fmt.Errorf("the provided graph is not topologically sortable because it contains a cycle")
)
Functions ¶
func EdgeSetsEqual ¶
EdgeSetsEqual returns whether the provided sets of edges have the same elements.
Types ¶
type Node ¶
type Node interface { GetLabel() int64 NumInNodes() int InNode(i int) Node NumOutNodes() int OutNode(i int) Node }
func DepthFirstTraverse ¶
func DepthFirstTraverse(root Node, t TraversalType) []Node
DepthFirstTraverse performs a depth first traversal with the given root as the starting point.
type TraversalType ¶
type TraversalType bool
const ( PreOrder TraversalType = true PostOrder TraversalType = false )
type Tree ¶
func NewTreeFromGraph ¶
NewTreeFromGraph attempts to convert the provided graph to a tree.
The second return value is true if and only if this conversion is possible.
Click to show internal directories.
Click to hide internal directories.