package
Version:
v0.1.0
Opens a new window with list of versions in this module.
Published: Dec 6, 2015
License: MIT
Opens a new window with license information.
Imports: 3
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
DAG is a Directed Acyclic Graph implemented with an adjacency list.
func NewDAG(v interface{}) *DAG
NewDAG constructs a new graph with a single root vertex.
Add inserts a vertex holding a value v in the graph.
AddEdge inserts an directed edge between two vertecies.
BFS walks the graph in breadth-first order.
DFS walks the graph in depth-first order.
Edges returns the outgoing edges for v.
Get returns the vertex for the corresponding value.
ReverseDFS walks the graph in reverse depth-first order.
type Vertex struct {
Value interface{}
}
Vertex is a vertex for DAG.
WalkFunc is a common func for all graph walking methods.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.