Update graph.m (used weighted average to determine optimal edge).
Merge pull request #2 from fredrickleber/patch-1

Update graph.m (used weighted average to determine optimal edge).