a more efficient way to access single-pair similarity over graphs