Parallel.degrees_tree: def of bend-visgraph@2.0.0.0 Import: import bend-visgraph@2.0.0.0/parallel.bend as Parallel Lines 180-194 of bend-visgraph@2.0.0.0/parallel.bend: https://jend.leeeet.dev/read.txt?path=bend-visgraph@2.0.0.0/parallel.bend&start_line=180&end_line=194 import Base import bend-visgraph@2.0.0.0/visgraph.bend as VG # Forks down the build's tree of EJoin into VG.degrees.into, which # forks nothing, so the runtime spreads the tallies over every thread. def degrees_tree(depth: Nat, es: VG.Edges, dd: Array & Array) -> Array: match depth es: case 1n++p VG.EJoin{a, b}: (d1, d2) = dd x y = degrees_tree(p, a, Array.fork(U32, d1)) degrees_tree(p, b, Array.fork(U32, d2)) Array.join(U32, x, y) case 0n VG.EJoin{a, b}: (d1, d2) = dd x y = VG.degrees.into(a, d1) VG.degrees.into(b, d2) Array.join(U32, x, y) case _ _: (d1, d2) = dd VG.degrees.into(es, Array.join(U32, d1, d2)) Uses (9): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Array https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Array.fork https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Array.join https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Pair https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Sigma https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=bend-visgraph@2.0.0.0/visgraph.bend&name=Edges https://jend.leeeet.dev/definition.txt?path=bend-visgraph@2.0.0.0/visgraph.bend&name=degrees.into