Graph connectivity exercise in Julia