graph algorithm applied to network planning