The efficiency gain comes from the fact that we can just do the multiplication once per path type, instead of once per path type per source node.
to correctly compute the probabilities for a (source, target) pair, we need to exclude from the graph the edge connecting that training instance.