might be possible to vectorize this like we extract edges for source space connectivity