Documentation ¶
Overview ¶
Contains algos and logic related to depth-first graph traversal.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindSources ¶
Finds all source vertices (vertices with no incoming edges) in the given directed graph.
func Search ¶
Performs a depth-first search for the given target vertex in the provided graph, beginning from the given start vertex.
A slice of vertices is returned, identifying the path from the start to the target vertex. If no path can be found, the returned slice is nil and an error is returned instead.
func Toposort ¶
Performs a topological sort using the provided graph. The third variadic parameter defines a set of vertices to start from; vertices unreachable from this starting set will not be included in the final sorted output.
If no starting vertices are provided, then a list of source vertices is built via FindSources(), and that set is used as the starting point. Because FindSources() requires a Digraph, an error will be returned if a non-directed graph is provided without any start vertices.
Types ¶
type TslVisitor ¶
type TslVisitor struct {
// contains filtered or unexported fields
}
func (*TslVisitor) OnBackEdge ¶
func (vis *TslVisitor) OnBackEdge(vertex gogl.Vertex)
func (*TslVisitor) OnExamineEdge ¶
func (vis *TslVisitor) OnExamineEdge(edge gogl.Edge)
func (*TslVisitor) OnFinishVertex ¶
func (vis *TslVisitor) OnFinishVertex(vertex gogl.Vertex)
func (*TslVisitor) OnStartVertex ¶
func (vis *TslVisitor) OnStartVertex(vertex gogl.Vertex)