func (d *DAG) Shape() bool {
	graph := d.graph
	for name, node := range graph {
		for dep := range node.OutEdge {
			if v, ok := graph[dep]; !ok {
				return false
			} else {
				v.InEdge[name] = true
				v.InCounter += 1
			}
		}
	}
	ok := d.enqueue() && d.dequeue()
	if !ok {
		return false
	}
	d.shaped = true
	return true
}
Shape : Check the DAG
package dag
import (
	"container/list"
)
type DAG struct {
	graph  map[string]*Node
	shaped bool
	e      []string
	d      []string
}
func (d *DAG) Init() {
	if d.graph == nil {
		d.graph = make(map[string]*Node)
	}
}
func (d *DAG) AddNode(name string, deps []string) bool {
	if _, v := d.graph[name]; v {
		return false
	}
	node := NewNode(deps)
	d.graph[name] = node
	d.shaped = false
	return true
}
func (d *DAG) addNodeByNode(name string, node Node) bool {
	if _, v := d.graph[name]; v {
		return false
	}
	n := Node{}
	n.InCounter = node.InCounter
	n.OutCounter = node.OutCounter
	n.InEdge = node.InEdge
	n.OutEdge = node.OutEdge
	d.graph[name] = &n
	d.shaped = false
	return true
}