« first day (1105 days earlier)      last day (1552 days later) » 

12:00 AM
Basically the code constructs an adjacency matrix where 1 means connected and 0 means disconnected (it's not related to distances in any way), and finding a transitive closure means to find all pairs of vertices that have some path between them.
 
@Bubbler I know what a graph is in terms of objects full of pointers to other objects, like a linked list on steroids, and in terms of shortest path algorithms. I don't know any of the maths behind them, or how one can be represented as an array
 
@TessellatingHeckler An adjacency matrix is a square matrix of zeroes and ones. Each row/column is associated with a vertex, and the element at (x,y) is 1 if vertex x and vertex y are connected with an edge, 0 otherwise.
If we have a graph of three vertices A, B, C where AB and BC are connected, its adjacency matrix is
  A B C
A 0 1 0
B 1 0 1
C 0 1 0
 
@Bubbler I was just getting to that in your wikipedia link; so it's simply giving every node a number, then doing that? That is surprisingly simple
 
@TessellatingHeckler Yes, exactly.
Given +.× computes element-wise × then sum, ∨.∧ computes element-wise "and" and then "any" of booleans. It is essentially solving "if we want to go from vertex a to vertex b, is there a two-step path a→c→b for some vertex c?"
Repeating the process gives pairs of vertices accessible within 3 steps, 4 steps, ... until we get no more updates. The result is a matrix showing which vertices are connected (within any distance). This is called "transitive closure".
 
12:21 AM
@Bubbler Thank you! I think that makes sense, but will need to stare at it for a while and try it
 
 
3 hours later…
ngn
2:59 AM
@Bubbler thanks for explaining it so well. i added these links to the answer.
@TessellatingHeckler the or-dot-and trick is one of the most beautiful apl expressions ever, worth staring at :) it comes up relatively often in golfing
it trades a bit of (worst-case) computational complexity - O(n^3 log(n)) vs floyd-warshall's O(n^3) - for conciseness. despite the additional log(n) factor, in practice it's likely to be faster than floyd-warshall because it makes use of optimized matrix multiplication and bit booleans.
 
ngn
3:34 AM
more examples of ∨.∧: 0 1
 
4:08 AM
@ngn Wow; I am amazed
 
 
1 hour later…
5:12 AM
I'm trying to use / (replicate), but I think APL keeps thinking it's reduction. I've got f←⊢(/⍨)(1 2⍴⍨≢) working, but ideally it would be (1 2⍴⍨≢)/⊢. Also it's funny that \ works pretty much the same way
 
> I think APL keeps thinking it's reduction
It indeed does.
 
darn, is there a better way of working around this than what I've got?
 
@JoKing This is slightly shorter, but replicate just doesn't work well with trains in general.
 
huh neat. I assume the last ⍨ is acting on the whole thing?
 
Yes.
 
5:26 AM
I was working on a dfn solution for the same bytecount {⍵/⍨1 2⍴⍨≢⍵}
 
ninja'd
So ⊢(op1)(op2) is equivalent to (op1)∘(op2)⍨? That's good to know for the future
Is dyadic / just a subset of dyadic \?
 
6:23 AM
@JoKing Not now, but in 18.0 you can always use ⊢⍤/ etc. to say "the function /"
@JoKing No, only / can remove cells.
 
 
1 hour later…
7:28 AM
@JoKing Shorter!
 
@Bubbler In dzaima/APL, is a pure function: Try it online!
 
 
2 hours later…
9:12 AM
@Adám I guess "∊⍴¨ instead of function / for non-boolean vectors" deserves a section in this tip?
 
@Bubbler Yes, immediately before or after ∊⊆. You have my permission to edit it in if you can keep the style: "Task: Given a…", "A dfn solution may be…", "{main content}", "Note that this does not work for higher-rank arrays.".
 
@Adám OK, I'll try.
 
 
4 hours later…
1:09 PM
@Adám - Is there an "expect date" for 18.0?
 
@JeffZeitlin This summer.
 
@Adám - I'll be looking forward to it!
 
Me too.
 
Have you been having fun with that 5100 emulator? :)
 
@JeffZeitlin Only a little bit. I added it to the APL Wiki.
 
1:20 PM
One of the things I'd like to do in my copious spare time would be to hack on that emulator so that one can save and change disks.
 

« first day (1105 days earlier)      last day (1552 days later) »