Test if two vertices are connected in a graph

The canonical algorithm is union find.

An example implementation is available here.

A word of warning: is_connected will often not be thread-safe, due to amortized lazy updates (“often” means: In many implementations in many programming languages; no idea what datastructures.jl; does).

1 Like