func sortNodeWithDistance (nodes []nodeWithDistance) []nodeWithDistance {
	sorted := make([]nodeWithDistance, len(nodes))
	copy(sorted, nodes)
	less := func(i, j int) bool {
		if sorted[i].node.GetId() < sorted[j].node.GetId() {
			return true
		} else {
			return false
		}
	}
	sort.Slice(sorted, less)
	return sorted
}
sortNodeWithDistance returns a slice of alphabetically-sorted nodeWithDistance elements
package phantom
import "sort"
type Node struct {
	id string
	parents map[*Node]struct{}
	children map[*Node]struct{}
}
type nodeWithDistance struct {
	node *Node
	distance int
}
func newNode(id string) *Node {
	return &Node{
		id: id,
		parents: make(map[*Node]struct{}),
		children: make(map[*Node]struct{}),
	}
}
func (n *Node) GetId() string {
	return n.id
}
func (n *Node) getChildren() *nodeSet {
	set := newNodeSet()
	for k := range n.children {
		set.add(k)
	}
	return set
}
func GetIds(nodes []*Node) []string {
	var ids = make([]string, len(nodes))
	for i, node := range nodes {
		ids[i] = node.GetId()
	}
	return ids
}
func SortNodes(nodes []*Node) []*Node {
	sorted := make([]*Node, len(nodes))
	copy(sorted, nodes)
	less := func(i, j int) bool {
		if nodes[i].GetId() < nodes[j].GetId() {
			return true
		} else {
			return false
		}
	}
	sort.Slice(sorted, less)
	return sorted
}