2 ms·
> "linear", which is definitely not used in any usual sense of the word: trees are linear, but graphs are not... huh? While I agree with your overall point, th
by a1369209993 6y ago
> "linear", which is definitely not used in any usual sense of the word: trees are linear, but graphs are not... huh?
While I agree with your overall point, this is a usual definition of linear: each item (eg graph/tree node) is used (eg pointed to) at most[0] once (eg each tree node has at most one parent node, whereas a graph node can have multiple edges from other nodes).
0→2 0→2
↓ ↓ ↓ ↓
1 3 1→3
Left is a tree, and linear (each node has only one arrow pointing at it), while Right is nonlinear because there are two ways to get to 3 (via 1 or 2). In this context it also means that if (eg) you print out the graph in a naive S-expression-style traversal you'd encounter 3 twice (eg "(0 (1 (3)) (2 (3)))" when each node is a list).
This sense comes from linear functions, which can be expressed with at most one use of their argument in the form λx(Ax+B) for A and B constant in x. (Under this scheme, x² would have to be expressed as x·x, which repeats x; linearity in programming languages generally allows numeric values to be duplicated freely, so this is only of etymological relevance.)
0: or possibly exactly once; I can never remember which of those is "linear" and which is "affine".