Added hamming distance for directed graph