visgraph.bend checks
raw source on the hub · import bend-visgraph@2.0.0.0/visgraph.bend as Visgraph
bend-visgraph's library: ts2vg's options and a series in, the graph out,
with no def that relies on @unsafe. Its graphs are ts2vg 1.2.4's, in F32.
parallel.bend builds the same graphs on every thread, and relies on Base's
@unsafe Array.fork; a program that does not import it passes
bend --check-only.
import bend-visgraph@2.0.0.0/visgraph.bend as VG
Its interface is the types at the top, inf and neg_inf, and the defs under "The library" at the bottom; every other def serves them.
1 import
import Base
Types
type Visibility source · line 13 · raw
Data
NaturalVisibility
HorizontalVisibility
type Direction source · line 17 · raw
Data
UndirectedDirection
LeftToRightDirection
TopToBottomDirection
type Weight source · line 22 · raw
Data
UnweightedWeight
DistanceWeight
SqDistanceWeight
VDistanceWeight
AbsVDistanceWeight
HDistanceWeight
AbsHDistanceWeight
SlopeWeight
AbsSlopeWeight
AngleWeight
AbsAngleWeight
NumPenetrationsWeight
type Xs source · line 38 · raw
Type
The x coordinate of each value: its index, or the value at the same index of an array.
IndexXs
At@xs:Array<F32> -> Xs
type Edges source · line 44 · raw
Data
The edges, as a rope: ECon adds an edge and EJoin joins two ropes, so the two halves of a split join in one step.
ENilEdges
ECon@src:U32 -> @dst:U32 -> @w:F32 -> @next:Edges -> Edges
EJoin@a:Edges -> @b:Edges -> Edges
type Options source · line 53 · raw
Data
The options of ts2vg's graph classes: the visibility, how its edges point,
their weight, the weights to keep (above min_weight and below
max_weight; neg_inf() and inf() keep every weight), and how many points
an edge may cross.
Options@visibility:Visibility -> @directed:Direction -> @weighted:Weight -> @min_weight:F32 -> @max_weight:F32 -> @penetrable_limit:U32 -> Options
type Series source · line 58 · raw
Type
The n values ys of a time series, indexed from 0, and their x: the
index, or At{xs} with the x of each value, increasing.
Series@n:U32 -> @ys:Array<F32> -> @xs:Xs -> Series
type Graph source · line 62 · raw
Data
A built graph: its n nodes, how its edges point, and its edges.
Graph@n:U32 -> @directed:Direction -> @edges:Edges -> Graph
type Adjacency source · line 70 · raw
Type
The graph as compressed rows: the neighbors of node i are
targets[offsets[i]] up to targets[offsets[i + 1]], increasing, and
the weights of their edges sit at the same positions. An undirected
graph's edge appears in the rows of both its ends, a directed one's in
its source's row.
Adjacency@offsets:Array<U32> -> @targets:Array<U32> -> @weights:Array<F32> -> Adjacency
type Stack source · line 217 · raw
Data
The stack holds the points no later point has beaten yet. A point pops the entries it beats; the entry left on top bounds its interval on the left, and the point that pops an entry bounds that entry's interval on the right.
KNilStack
KCon@i:U32 -> @key:F32 -> @next:Stack -> Stack
type Popped source · line 230 · raw
Type
The work only balances the split, so F32 rounding does no harm.
Popped@first:U32 -> @below:F32 -> @st:Stack -> @rights:Array<U32> -> @visits:F32 -> Popped
type Cols source · line 253 · raw
Type
lefts and rights count the points each point's left and right sweeps visit.
Cols@ys:Array<F32> -> @lefts:Array<U32> -> @rights:Array<U32> -> Cols
type Arrived source · line 256 · raw
Type
OpensWithNaN@rights:Array<U32> -> @visits:F32 -> Arrived
PopsAll@rights:Array<U32> -> @visits:F32 -> Arrived
Bounded@first:U32 -> @below:F32 -> @st:Stack -> @rights:Array<U32> -> @visits:F32 -> Arrived
type Unbounded source · line 284 · raw
Data
Latest first.
UNilUnbounded
UCon@i:U32 -> @y:F32 -> @next:Unbounded -> Unbounded
type Block source · line 290 · raw
Data
A block of points runs the stack on its own points. Its points that pop its whole stack, and the NaNs that open it, need the points before it.
Block@start:U32 -> @opening_nans:U32 -> @unbounded:Unbounded -> @st:Stack -> @visits:F32 -> Block
type Local source · line 293 · raw
Type
Local@b:Block -> @c:Cols -> Local
type Merged source · line 331 · raw
Type
Merged@st:Stack -> @lefts:Array<U32> -> @rights:Array<U32> -> @visits:F32 -> Merged
type Walked source · line 397 · raw
Type
Bend matches only parameters, so a read's result must arrive as one: a
sweep reads y and x at ahead, where the next sweep starts, and hands them
over. The sweeps read x through x_at, so x as the index costs no read.
Walked@yr:Pair(Array<F32>, F32) -> @xr:Pair(Array<F32>, F32) -> @es:Edges -> Walked
type Out source · line 488 · raw
Type
Out@cols:Cols -> @xs:Array<F32> -> @es:Edges -> Out
type Pts source · line 578 · raw
Data
The points, in a list the parallel ranges share.
PNilPts
PCon@i:U32 -> @x:F32 -> @y:F32 -> @next:Pts -> Pts
type Tops source · line 599 · raw
Data
The limit + 1 largest slopes (or heights) a sweep has accepted, as ts2vg's
max_slopes; the sweep accepts a point above the smallest of them.
TNilTops
TCon@v:F32 -> @next:Tops -> Tops
type Low source · line 604 · raw
Data
The position and value of the first smallest top.
Low@k:Nat -> @v:F32 -> Low
type Counts source · line 890 · raw
Type
Counts@outs:Array<U32> -> @ins:Array<U32> -> Counts
type Halves source · line 923 · raw
Type
The half edges, by target: source, target and weight at each position.
Halves@cur:Array<U32> -> @us:Array<U32> -> @vs:Array<U32> -> @ws:Array<F32> -> Halves
type Rows source · line 947 · raw
Type
Rows@cur:Array<U32> -> @targets:Array<U32> -> @weights:Array<F32> -> Rows
Definitions
def nan source · line 77 · raw
F32
def inf source · line 80 · raw
F32
def neg_inf source · line 83 · raw
F32
def is_nan source · line 86 · raw
@+a:F32 -> Bool
def pick source · line 89 · raw
@c:Bool -> @a:F32 -> @b:F32 -> F32
def pick_u32 source · line 96 · raw
@c:Bool -> @a:U32 -> @b:U32 -> U32
def sq_distance source · line 106 · raw
@+x1:F32 -> @+x2:F32 -> @+y1:F32 -> @+y2:F32 -> F32
def known_slope source · line 109 · raw
@+s:F32 -> @+x1:F32 -> @+x2:F32 -> @+y1:F32 -> @+y2:F32 -> F32
def weight source · line 112 · raw
@+k:Weight -> @+x1:F32 -> @+x2:F32 -> @+y1:F32 -> @+y2:F32 -> @+s:F32 -> F32
def put source · line 142 · raw
@drop:Bool -> @i1:U32 -> @i2:U32 -> @w:F32 -> @es:Edges -> Edges
def add_edge source · line 149 · raw
@+k:Weight -> @+lo:F32 -> @+hi:F32 -> @i1:U32 -> @i2:U32 -> @+x1:F32 -> @+x2:F32 -> @+y1:F32 -> @+y2:F32 -> @+s:F32 -> @es:Edges -> Edges
def add_right source · line 154 · raw
@seen:Bool -> @+k:Weight -> @+lo:F32 -> @+hi:F32 -> @ia:U32 -> @ib:U32 -> @xa:F32 -> @xb:F32 -> @ya:F32 -> @yb:F32 -> @s:F32 -> @es:Edges -> Edges
A visible point right of the pivot a: the edge (a, b).
def add_left_dir source · line 163 · raw
@dir:Direction -> @+k:Weight -> @+lo:F32 -> @+hi:F32 -> @ia:U32 -> @ib:U32 -> @xa:F32 -> @xb:F32 -> @ya:F32 -> @yb:F32 -> @s:F32 -> @es:Edges -> Edges
A visible point left of the pivot a: the edge (a, b) for top_to_bottom, else (b, a).
def add_left source · line 170 · raw
@seen:Bool -> @+dir:Direction -> @+k:Weight -> @+lo:F32 -> @+hi:F32 -> @ia:U32 -> @ib:U32 -> @xa:F32 -> @xb:F32 -> @ya:F32 -> @yb:F32 -> @s:F32 -> @es:Edges -> Edges
def abs_tol source · line 179 · raw
F32
def rel_tol source · line 182 · raw
F32
def scale source · line 186 · raw
@+xa:F32 -> @+ya:F32 -> F32
max(|xa|, |ya|), which a sweep computes once.
def tol source · line 192 · raw
@+scale_a:F32 -> @+xb:F32 -> @+yb:F32 -> F32
ts2vg's tolerance for the points a and b. F32.max only picks one of its words, so grouping the four maxima this way gives ts2vg's word.
def greater source · line 195 · raw
@+a:F32 -> @+b:F32 -> @+t:F32 -> Bool
def clears source · line 201 · raw
@up:Bool -> @+s:F32 -> @+best:F32 -> @+scale_a:F32 -> @+xb:F32 -> @+yb:F32 -> Bool
greater(s, best, tol(scale_a, xb, yb)), with the tolerance computed only when s is above best: the tolerance is positive, so otherwise it fails anyway.
def key source · line 226 · raw
@+y:F32 -> @+below:F32 -> F32
What a later point must beat to pop y. An equal point beats nothing, so an interval's first highest point is its pivot. A NaN beats nothing either, and ts2vg's argmax takes it only as an interval's first point, so a NaN at i is the pivot of the right side of i - 1: it takes the key of the entry below it and leaves the stack with that entry.
def pops source · line 233 · raw
@rest:Stack -> @beat:Bool -> @+y:F32 -> @+i:U32 -> @+j:U32 -> @+kj:F32 -> @rights:Array<U32> -> @+visits:F32 -> Popped
def flush source · line 244 · raw
@st:Stack -> @+n:U32 -> @rights:Array<U32> -> @+visits:F32 -> Pair(Array<U32>, F32)
def lpops source · line 261 · raw
@rest:Stack -> @beat:Bool -> @+y:F32 -> @+i:U32 -> @+j:U32 -> @+kj:F32 -> @rights:Array<U32> -> @+visits:F32 -> Arrived
def arrive source · line 272 · raw
@st:Stack -> @nan:Bool -> @+y:F32 -> @+i:U32 -> @rights:Array<U32> -> @+visits:F32 -> Arrived
def local source · line 296 · raw
@count:Nat -> @+i:U32 -> @+y:F32 -> @a:Arrived -> @yr:Pair(Array<F32>, F32) -> @lefts:Array<U32> -> @+start:U32 -> @+opening_nans:U32 -> @unbounded:Unbounded -> Local
def block_pass source · line 322 · raw
@count:Nat -> @+s:U32 -> @yr:Pair(Array<F32>, F32) -> @lefts:Array<U32> -> @rights:Array<U32> -> Local
def push_with_key source · line 334 · raw
@count:Nat -> @+i:U32 -> @+k:F32 -> @st:Stack -> Stack
def push_opening_nans source · line 341 · raw
@count:Nat -> @+i:U32 -> @st:Stack -> Stack
def pops_from source · line 348 · raw
@st:Stack -> @+y:F32 -> @+i:U32 -> @rights:Array<U32> -> @+visits:F32 -> Popped
def set_left source · line 355 · raw
@+i:U32 -> @lefts:Array<U32> -> @p:Popped -> Merged
def in_order source · line 360 · raw
@u:Unbounded -> @acc:Unbounded -> Unbounded
def bound_unbounded source · line 367 · raw
@u:Unbounded -> @m:Merged -> Merged
def onto source · line 375 · raw
@st:Stack -> @acc:Stack -> Stack
def push_block_stack source · line 382 · raw
@st:Stack -> @m:Merged -> Merged
def merge_block source · line 389 · raw
@b:Block -> @m:Merged -> Merged
The merge replays the stack over every point before the block. The points the block's own stack could not bound pop it in order; the others sit on the block's stack, which goes on top.
def at_index source · line 400 · raw
@xs:Array<F32> -> @+j:U32 -> Pair(Array<F32>, F32)
def right_sweep source · line 458 · raw
@g:Visibility -> @index:Bool -> @count:Nat -> @yr:Pair(Array<F32>, F32) -> @xs:Array<F32> -> @+k:Weight -> @+lo:F32 -> @+hi:F32 -> @+ia:U32 -> @+xa:F32 -> @+ya:F32 -> @es:Edges -> Walked
Each sweep, with x as the index (index) or read from xs.
def left_sweep source · line 469 · raw
@g:Visibility -> @index:Bool -> @count:Nat -> @+dir:Direction -> @+k:Weight -> @+lo:F32 -> @+hi:F32 -> @+ia:U32 -> @+xa:F32 -> @+ya:F32 -> @w:Walked -> Walked
def points source · line 491 · raw
@count:Nat -> @+i:U32 -> @lr:Pair(Array<U32>, U32) -> @rr:Pair(Array<U32>, U32) -> @w:Walked -> @+index:Bool -> @+g:Visibility -> @+dir:Direction -> @+k:Weight -> @+lo:F32 -> @+hi:F32 -> Out
def edges_of source · line 510 · raw
@o:Out -> Edges
def swept source · line 514 · raw
@+index:Bool -> @+g:Visibility -> @+dir:Direction -> @+k:Weight -> @+lo:F32 -> @+hi:F32 -> @+n:U32 -> @ys:Array<F32> -> @xs:Array<F32> -> @lefts:Array<U32> -> @r:Pair(Array<U32>, F32) -> Edges
def bounded source · line 518 · raw
@+index:Bool -> @+g:Visibility -> @+dir:Direction -> @+k:Weight -> @+lo:F32 -> @+hi:F32 -> @+n:U32 -> @ys:Array<F32> -> @xs:Array<F32> -> @m:Merged -> Edges
def stacked source · line 522 · raw
@+index:Bool -> @+g:Visibility -> @+dir:Direction -> @+k:Weight -> @+lo:F32 -> @+hi:F32 -> @+n:U32 -> @xs:Array<F32> -> @l:Local -> Edges
def slots source · line 528 · raw
@+n:U32 -> Array<U32>
An array with room for n slots, indexed from 0.
def no_xs source · line 532 · raw
Array<F32>
A stand-in for xs when x is the index, which no sweep reads.
def built source · line 535 · raw
@+index:Bool -> @+g:Visibility -> @+dir:Direction -> @+k:Weight -> @+lo:F32 -> @+hi:F32 -> @ys:Array<F32> -> @xs:Array<F32> -> @+n:U32 -> Edges
def visibility source · line 544 · raw
@+g:Visibility -> @+dir:Direction -> @+k:Weight -> @+lo:F32 -> @+hi:F32 -> @ys:Array<F32> -> @xs:Xs -> @+n:U32 -> Edges
The graph of the n values ys at xs, on one thread, as one block.
lo and hi bound the weights, as ts2vg's min_weight and max_weight;
pass neg_inf() and inf() for no bound. The x of Index{} is the index as
an F32, exact for up to 2^24 values; the x of At{xs} must increase.
parallel.bend builds the same graph on every thread, and relies on
Base's @unsafe Array.fork.
def added source · line 554 · raw
@r:Pair(Array<U32>, U32) -> Array<U32>
def atomic_bump source · line 558 · raw
@d:Array<U32> -> @+i:U32 -> Array<U32>
def degrees.into source · line 563 · raw
@es:Edges -> @d:Array<U32> -> Array<U32>
The degrees of the nodes of es, added into d; parallel.bend counts
them on every thread.
def penetrable.points source · line 585 · raw
@count:Nat -> @+i:U32 -> @yr:Pair(Array<F32>, F32) -> @xr:Pair(Array<F32>, F32) -> @+index:Bool -> @acc:Pts -> Pts
The points of ys and xs from index i down to 0, onto acc; yr
and xr hold y and x at i, and x is the index if index says so. The
last read, at index -1, wraps around.
def tops_new source · line 607 · raw
@n:Nat -> Tops
def pick_low source · line 614 · raw
@c:Bool -> @a:Low -> @b:Low -> Low
def low_from source · line 621 · raw
@ts:Tops -> @+k:Nat -> @+best:Low -> Low
def lowest source · line 629 · raw
@ts:Tops -> Low
def Low.v source · line 632 · raw
@+l:Low -> F32
def set_at source · line 636 · raw
@k:Nat -> @ts:Tops -> @v:F32 -> Tops
def blocked_natural source · line 647 · raw
@ts:Tops -> @+s:F32 -> @+t:F32 -> @+n:F32 -> F32
How many tops a natural edge with slope s does not clear, as ts2vg's
num_penetrations weight.
def blocked_horizontal source · line 654 · raw
@ts:Tops -> @+ya:F32 -> @+yb:F32 -> @+n:F32 -> F32
def add_known source · line 663 · raw
@+k:Weight -> @+lo:F32 -> @+hi:F32 -> @i1:U32 -> @i2:U32 -> @+x1:F32 -> @+x2:F32 -> @+y1:F32 -> @+y2:F32 -> @+s:F32 -> @+known:F32 -> @es:Edges -> Edges
ts2vg's add_edge with a known weight: NaN means the weight function computes it.
def add_oriented source · line 668 · raw
@down:Bool -> @+k:Weight -> @+lo:F32 -> @+hi:F32 -> @ia:U32 -> @ib:U32 -> @xa:F32 -> @xb:F32 -> @ya:F32 -> @yb:F32 -> @s:F32 -> @known:F32 -> @es:Edges -> Edges
The edge from a to b, or from b to a for top_to_bottom when b is higher.
def is_down source · line 675 · raw
@dir:Direction -> @+ya:F32 -> @+yb:F32 -> Bool
def is_count source · line 682 · raw
@k:Weight -> Bool
def natural_edge source · line 689 · raw
@+dir:Direction -> @+k:Weight -> @+lo:F32 -> @+hi:F32 -> @ia:U32 -> @ib:U32 -> @+xa:F32 -> @+xb:F32 -> @+ya:F32 -> @+yb:F32 -> @+s:F32 -> @+scale_a:F32 -> @ts:Tops -> @es:Edges -> Edges
def horizontal_edge source · line 693 · raw
@+dir:Direction -> @+k:Weight -> @+lo:F32 -> @+hi:F32 -> @ia:U32 -> @ib:U32 -> @+xa:F32 -> @xb:F32 -> @+ya:F32 -> @+yb:F32 -> @ts:Tops -> @es:Edges -> Edges
def natural_sweep source · line 701 · raw
@pts:Pts -> @up:Bool -> @+dir:Direction -> @+k:Weight -> @+lo:F32 -> @+hi:F32 -> @+ia:U32 -> @+xa:F32 -> @+ya:F32 -> @+scale_a:F32 -> @+ts:Tops -> @low:Low -> @+ib:U32 -> @+xb:F32 -> @+yb:F32 -> @+sb:F32 -> @es:Edges -> Edges
The sweep of point a over the points right of it: ts2vg's inner loop. A
point b the sweep sees replaces the smallest top and adds its edge at the
next step, when up says so, so a step after an unseen point calls no
def that recurses.
def horizontal_sweep source · line 720 · raw
@pts:Pts -> @up:Bool -> @stop:Bool -> @+dir:Direction -> @+k:Weight -> @+lo:F32 -> @+hi:F32 -> @+ia:U32 -> @+xa:F32 -> @+ya:F32 -> @+ts:Tops -> @low:Low -> @+ib:U32 -> @+xb:F32 -> @+yb:F32 -> @es:Edges -> Edges
The same for the horizontal sweep, which stops once the smallest top is above a: no later point can be seen.
def sweep source · line 737 · raw
@g:Visibility -> @+dir:Direction -> @+k:Weight -> @+lo:F32 -> @+hi:F32 -> @+limit:Nat -> @ia:U32 -> @+xa:F32 -> @+ya:F32 -> @pts:Pts -> @es:Edges -> Edges
def sweeps source · line 746 · raw
@pts:Pts -> @count:Nat -> @+g:Visibility -> @+dir:Direction -> @+k:Weight -> @+lo:F32 -> @+hi:F32 -> @+limit:Nat -> Edges
The sweeps of the first count points of pts, one rope each: ts2vg's
outer loop.
def drop source · line 753 · raw
@n:Nat -> @pts:Pts -> Pts
def first_half source · line 764 · raw
@g:Visibility -> @+len:U32 -> @+count:U32 -> U32
How many of the first count of len points do half the sweeps' work. A
natural sweep walks every point right of its start, so the first c starts
walk c (2 len - 1 - c) / 2 points; a horizontal sweep stops early, so
halving the starts is close enough.
def split source · line 776 · raw
@depth:Nat -> @+g:Visibility -> @+dir:Direction -> @+k:Weight -> @+lo:F32 -> @+hi:F32 -> @+limit:Nat -> @+pts:Pts -> @+len:U32 -> @+cu:U32 -> @+count:Nat -> Edges
The sweeps of the first count points of pts, as two halves of equal
work in parallel, depth times over. len and cu are pts's length
and count as U32; they only place the cut.
def penetrable.built source · line 786 · raw
@+index:Bool -> @+g:Visibility -> @+dir:Direction -> @+k:Weight -> @+lo:F32 -> @+hi:F32 -> @+limit:U32 -> @ys:Array<F32> -> @xs:Array<F32> -> @+n:U32 -> Edges
def penetrable source · line 792 · raw
@+g:Visibility -> @+dir:Direction -> @+k:Weight -> @+lo:F32 -> @+hi:F32 -> @+limit:U32 -> @ys:Array<F32> -> @xs:Xs -> @+n:U32 -> Edges
The limited penetrable graph of the n values ys at xs, crossing at
most limit points. The x of Index{} is the index as an F32, exact
for up to 2^24 values; the x of At{xs} must increase.
def options source · line 803 · raw
@v:Visibility -> Options
ts2vg's defaults for the visibility v: undirected, unweighted, every
weight kept, no point crossed.
def length source · line 806 · raw
@vs:List<&2, F32> -> @+n:U32 -> U32
def fill source · line 813 · raw
@vs:List<&2, F32> -> @+i:U32 -> @a:Array<F32> -> Array<F32>
def column source · line 820 · raw
@+n:U32 -> @vs:List<&2, F32> -> Array<F32>
def counted source · line 823 · raw
@+n:U32 -> @ys:List<&2, F32> -> Series
def series source · line 827 · raw
@+ys:List<&2, F32> -> Series
The series of the values ys, each at its index.
def counted_at source · line 830 · raw
@+n:U32 -> @xs:List<&2, F32> -> @ys:List<&2, F32> -> Series
def series_at source · line 835 · raw
@xs:List<&2, F32> -> @+ys:List<&2, F32> -> Series
The series of the values ys at xs, which must hold as many values,
increasing.
def chosen source · line 838 · raw
@is_visibility:Bool -> @+g:Visibility -> @+dir:Direction -> @+k:Weight -> @+lo:F32 -> @+hi:F32 -> @+limit:U32 -> @ys:Array<F32> -> @xs:Xs -> @+n:U32 -> Edges
def build source · line 848 · raw
@o:Options -> @s:Series -> Graph
The graph of s with the options o, with the edges ts2vg's build
makes. The natural and horizontal graphs run on one thread, and the
limited penetrable ones split their sweeps among every thread.
def degrees source · line 872 · raw
@g:Graph -> Array<U32>
The degree of each node of g, as ts2vg's degrees: the edges at the
node, in either direction.
def is_undirected source · line 879 · raw
@d:Direction -> Bool
def bumped source · line 886 · raw
@r:Pair(Array<U32>, U32) -> @+i:U32 -> Array<U32>
def count_half source · line 893 · raw
@present:Bool -> @+u:U32 -> @+v:U32 -> @c:Counts -> Counts
def count_halves source · line 901 · raw
@es:Edges -> @+both:Bool -> @c:Counts -> Counts
def starts source · line 912 · raw
@count:Nat -> @+i:U32 -> @r:Pair(Array<U32>, U32) -> @+acc:U32 -> Array<U32>
The counts of n nodes, in place, as where each node's run starts; slot
n gets the total.
def put_half source · line 926 · raw
@+u:U32 -> @+v:U32 -> @+w:F32 -> @r:Pair(Array<U32>, U32) -> @us:Array<U32> -> @vs:Array<U32> -> @ws:Array<F32> -> Halves
def place_half source · line 930 · raw
@present:Bool -> @+u:U32 -> @+v:U32 -> @+w:F32 -> @h:Halves -> Halves
def by_target source · line 938 · raw
@es:Edges -> @+both:Bool -> @h:Halves -> Halves
def put_row source · line 950 · raw
@+u:U32 -> @+v:U32 -> @+w:F32 -> @r:Pair(Array<U32>, U32) -> @targets:Array<U32> -> @weights:Array<F32> -> Rows
def by_source source · line 956 · raw
@count:Nat -> @+p:U32 -> @ur:Pair(Array<U32>, U32) -> @vr:Pair(Array<U32>, U32) -> @wr:Pair(Array<F32>, F32) -> @out:Rows -> Rows
The half edges from position p on, in target order, into their
sources' rows.
def slots_for source · line 971 · raw
@+n:U32 -> Nat
def rows_done source · line 974 · raw
@offsets:Array<U32> -> @r:Rows -> Adjacency
def rows_from source · line 978 · raw
@+h:U32 -> @oc:Pair(Array<U32>, Array<U32>) -> @hv:Halves -> Adjacency
def with_starts source · line 983 · raw
@es:Edges -> @+both:Bool -> @+h:U32 -> @outs:Array<U32> -> @ins:Array<U32> -> Adjacency
def with_total source · line 986 · raw
@es:Edges -> @+both:Bool -> @r:Pair(Array<U32>, U32) -> @ins:Array<U32> -> Adjacency
def tallied source · line 990 · raw
@es:Edges -> @+both:Bool -> @+n:U32 -> @c:Counts -> Adjacency
def adjacency source · line 995 · raw
@g:Graph -> Adjacency
The rows of the nodes of g.
Templates
template natural_right source · line 403 · raw
@-x_at:(@_:Array<F32> -> @_:U32 -> Pair(Array<F32>, F32)) -> @count:Nat -> @+j:U32 -> @yr:Pair(Array<F32>, F32) -> @xr:Pair(Array<F32>, F32) -> @+k:Weight -> @+lo:F32 -> @+hi:F32 -> @+ia:U32 -> @+xa:F32 -> @+ya:F32 -> @+scale_a:F32 -> @+best:F32 -> @es:Edges -> @+ahead:U32 -> Walked
template natural_left source · line 417 · raw
@-x_at:(@_:Array<F32> -> @_:U32 -> Pair(Array<F32>, F32)) -> @count:Nat -> @+j:U32 -> @yr:Pair(Array<F32>, F32) -> @xr:Pair(Array<F32>, F32) -> @+dir:Direction -> @+k:Weight -> @+lo:F32 -> @+hi:F32 -> @+ia:U32 -> @+xa:F32 -> @+ya:F32 -> @+scale_a:F32 -> @+best:F32 -> @es:Edges -> @+ahead:U32 -> Walked
template horizontal_right source · line 431 · raw
@-x_at:(@_:Array<F32> -> @_:U32 -> Pair(Array<F32>, F32)) -> @count:Nat -> @+j:U32 -> @yr:Pair(Array<F32>, F32) -> @xr:Pair(Array<F32>, F32) -> @+k:Weight -> @+lo:F32 -> @+hi:F32 -> @+ia:U32 -> @+xa:F32 -> @+ya:F32 -> @+best:F32 -> @es:Edges -> @+ahead:U32 -> Walked
template horizontal_left source · line 444 · raw
@-x_at:(@_:Array<F32> -> @_:U32 -> Pair(Array<F32>, F32)) -> @count:Nat -> @+j:U32 -> @yr:Pair(Array<F32>, F32) -> @xr:Pair(Array<F32>, F32) -> @+dir:Direction -> @+k:Weight -> @+lo:F32 -> @+hi:F32 -> @+ia:U32 -> @+xa:F32 -> @+ya:F32 -> @+best:F32 -> @es:Edges -> @+ahead:U32 -> Walked
template fold.edges source · line 857 · raw
@-A:Type -> @-f:(@_:A -> @_:U32 -> @_:U32 -> @_:F32 -> A) -> @es:Edges -> @acc:A -> A
f(acc, src, dst, w) over every edge of g, in the order the rope
holds them, from acc.
template fold source · line 866 · raw
@-A:Type -> @-f:(@_:A -> @_:U32 -> @_:U32 -> @_:F32 -> A) -> @g:Graph -> @acc:A -> A