implemented EdgeWeighedGraph and its auxiliary class Edge