OK, so I fixed the issue with nodes and their sources (the nodes that point to the node) being in the same horizontal layer. (If I had looked carefully
last week, I would have noticed them back then.)
The first problem was that I was adding each node to the list of "nodes added to previous layers" as soon as I assigned a layer to this. Then, when I'd look at the next node, I'd check its sources against the list of "nodes added to previous layers" and say, yes, it's there, so we can add it this layer.
However, sometimes the sources were not actually added to a
previous layer. They were added to the
current layer. That is how I got a node and its source in the same layer.
Once I fixed this, though, sometimes the assignment function would quit with a ton of unassigned nodes. The algorithm needs multiple passes through the unassigned nodes; I was doing just one.
In the second+ pass, a node that couldn't be added in the first pass because some its sources weren't yet assigned to a previous layer can now be assigned. (It takes about five passes to finish assigning the nodes in the graph in this screenshot.)
So, this weekend I can move in earnest to working on edge crossings, I think.