The documentation of ri() states
"Return the resistance (in megohms) between the center of the segment containing x and
its parent segment. This can be used to compute axial current given the voltage at two
adjacent points. If there is no parent the "infinite" resistance returned is 1e30."
Your example produces a model with this topology, as revealed by typing
topology()
at the oc> prompt:
Notice that in C, range increases with increasing distance from the soma,
but in B and A range decreases with increasing distance from the soma.
This is why the results are confusing.
The root section of this tree is C. The first value printed by
C for (x) {print ri(x)}
is 1e+30 because the 0 node of C has no parent segment.
The second and third values are the path resistance from the middle of C
to the 0 end of C, and from the 1 end of C to the middle of C.
The first two values printed by
B for (x) {print ri(x)}
are the path resistance from the 0 node of B to the middle of B
and from the middle of B to the 1 node of B.
The third value is 1e+30 because the 1 node of B is attached to the 0 node
of C, so it has no parent segment because the 0 node of C has no parent
segment.
The three values printed by
A for (x) {print ri(x)}
are the path resistances from the 0 node of A to its middle node,
from its middle node to its 1 node, and from its 1 node to the middle node
of B, its parent section.
To avoid such confusing results, never do this
connect b(1), a(0)
or this
connect b(1), a(1)
because the resulting topologies will have some sections in which
increasing range means more distance from the root of the tree, and
other sections in which increasing range means closer to the root.
This also messes up space plots and makes it difficult to write code
that sets up nonuniform distributions of biophysical properties, such
as channel densities.
Either of these is OK
connect b(0), a(0)
connect b(0), a(1)
because it will produce a topology in which increasing range means
increasing distance from the root of the tree.