private int GetEdgeWeight(AdjacencyListGraph <int> graph, AdjacencyVertex <int> first, AdjacencyVertex <int> second) { var edge = graph.GetEdge(first, second); return(edge == null ? int.MaxValue : edge.Weight); }