The user provides a function to fold a single constructor (an "algebra").
The result contains the result of folding the whole graph as well as the
result of each internal node, represented both as an array and an association
list. Each node is processed exactly once.