func (g LabeledDirected) FromList() (*FromList, NI) {
	paths := make([]PathEnd, len(g.LabeledAdjacencyList))
	for i := range paths {
		paths[i].From = -1
	}
	for fr, to := range g.LabeledAdjacencyList {
		for _, to := range to {
			if paths[to.To].From >= 0 {
				return nil, to.To
			}
			paths[to.To].From = NI(fr)
		}
	}
	return &FromList{Paths: paths}, -1
}
FromList transposes a labeled graph into a FromList.

Receiver g should be connected as a tree or forest.  Specifically no node
can have multiple incoming arcs.  If any node n in g has multiple incoming
arcs, the method returns (nil, n) where n is a node with multiple
incoming arcs.

Otherwise (normally) the method populates the From members in a
FromList.Path and returns the FromList and -1.

Other members of the FromList are left as zero values.
Use FromList.RecalcLen and FromList.RecalcLeaves as needed.

Unusual cases are parallel arcs and loops.  A parallel arc represents
a case of multiple arcs going to some node and so will lead to a (nil, n)
return, even though a graph might be considered a multigraph tree.
A single loop on a node that would otherwise be a root node, though,
is not a case of multiple incoming arcs and so does not force a (nil, n)
result.

There are equivalent labeled and unlabeled versions of this method.
package graph
func (g LabeledDirected) Balanced() bool {
	for n, in := range g.InDegree() {
		if in != len(g.LabeledAdjacencyList[n]) {
			return false
		}
	}
	return true
}
func (g LabeledDirected) Copy() (c LabeledDirected, ma int) {
	l, s := g.LabeledAdjacencyList.Copy()
	return LabeledDirected{l}, s
}
func (g LabeledDirected) Cyclic() (cyclic bool, fr NI, to Half) {
	a := g.LabeledAdjacencyList
	fr, to.To = -1, -1
	var temp, perm Bits
	var df func(NI)
	df = func(n NI) {
		switch {
		case temp.Bit(n) == 1:
			cyclic = true
			return
		case perm.Bit(n) == 1:
			return
		}
		temp.SetBit(n, 1)
		for _, nb := range a[n] {
			df(nb.To)
			if cyclic {
				if fr < 0 {
					fr, to = n, nb
				}
				return
			}
		}
		temp.SetBit(n, 0)
		perm.SetBit(n, 1)
	}
	for n := range a {
		if perm.Bit(NI(n)) == 1 {
			continue
		}
		if df(NI(n)); cyclic {  
			break
		}
	}
	return
}