added distance comparison
added directed edge hints