package dag

Import Path
	internal/dag (on go.dev)

Dependency Relation
	imports 4 packages, and imported by 0 packages

Involved Source Files alg.go Package dag implements a language for expressing directed acyclic graphs. The general syntax of a rule is: a, b < c, d; which means c and d come after a and b in the partial order (that is, there are edges from c and d to a and b), but doesn't provide a relative order between a vs b or c vs d. The rules can chain together, as in: e < f, g < h; which is equivalent to e < f, g; f, g < h; Except for the special bottom element "NONE", each name must appear exactly once on the right-hand side of any rule. That rule serves as the definition of the allowed successor for that name. The definition must appear before any uses of the name on the left-hand side of a rule. (That is, the rules themselves must be ordered according to the partial order, for easier reading by people.) Negative assertions double-check the partial order: i !< j means that it must NOT be the case that i < j. Negative assertions may appear anywhere in the rules, even before i and j have been defined. Comments begin with #.
Package-Level Type Names (only one)
/* sort by: | */
Nodes []string (*Graph) AddEdge(from, to string) (*Graph) DelEdge(from, to string) (*Graph) Edges(from string) []string (*Graph) HasEdge(from, to string) bool Topo returns a topological sort of g. This function is deterministic. TransitiveReduction removes edges from g that are transitively reachable. g must be transitively closed. Transpose reverses all edges in g. func Parse(dag string) (*Graph, error)
Package-Level Functions (only one)
Parse parses the DAG language and returns the transitive closure of the described graph. In the returned graph, there is an edge from "b" to "a" if b < a (or a > b) in the partial order.