Documentation ¶
Overview ¶
Package dags visualizes a DAG graph into a structured, layered planer map.
Index ¶
- func CheckDAG(g *Graph) error
- func Layout(g *Graph) (*Map, *MapView, error)
- func LayoutJSON(g *Graph) ([]byte, error)
- func RevLayout(g *Graph) (*Map, *MapView, error)
- func RevLayoutJSON(g *Graph) ([]byte, error)
- func TopoSort(g *Graph) ([]string, error)
- type Graph
- type M
- type Map
- type MapNode
- type MapNodeView
- type MapView
- type N
- type Repo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckDAG ¶
CheckDAG checks if a graph is a valid DAG. It returns true when all the graph, links are valid and has no circular dependency.
func LayoutJSON ¶
LayoutJSON layouts a DAG into a map in json format.
func RevLayout ¶
RevLayout layouts a DAG into a map from right to left its more suitable for top-down designed projects.
func RevLayoutJSON ¶
RevLayoutJSON layouts a DAG into a map in json format.
Types ¶
type Graph ¶
Graph is a directed graph
type Map ¶
Map is a visualized DAG
func Closure ¶
Closure makes the minimum sub map of a map that contains all the given nodes, and nodes that are in between these nodes.
func NewMap ¶
NewMap creates a map from a graph where all the ins and outs are populated, and nodes are mapped into layers.
func (*Map) SortedLayers ¶
SortedLayers returns nodes that are sorted in topological layers. Each node resides in its lowest possible layer.
func (*Map) SortedNodes ¶
SortedNodes returns a nodes that are sorted in topological order.
type MapNode ¶
type MapNode struct { Name string Ins map[string]*MapNode // direct input nodes Outs map[string]*MapNode // direct output nodes AllIns map[string]*MapNode // direct and indirect input nodes AllOuts map[string]*MapNode // direct and indirect output nodes // critical nodes is the minimum set of nodes that keeps // the same partial order of the nodes in the DAG graph CritIns map[string]*MapNode // critical input nodes CritOuts map[string]*MapNode // critical output nodes // contains filtered or unexported fields }
MapNode is a node in the DAG graph
func AllInsSorted ¶
AllInsSorted returns all the input nodes of a node in layering order.
type MapNodeView ¶
type MapNodeView struct { Name string DisplayName string X, Y int CritIns []string CritOuts []string }
MapNodeView is the position of a map node.
type MapView ¶
type MapView struct { Height int Width int Nodes map[string]*MapNodeView IsTopDown bool }
MapView is a layout view of a Map.
func (*MapView) AssignDisplayName ¶
AssignDisplayName assigns display names in a map.