public E GetEdgeIncludingTheWeight(string startVertexId, string endVertexId) { string key = EdgeGenericsImpl <V, W> .CreateEdgeIdValue(startVertexId, endVertexId); if (!mapWithEdgesAndVertexConcatenationAsKey.ContainsKey(key)) { throw new GraphValidationException("No edge with these vertices: from " + startVertexId + " to " + endVertexId); } return(mapWithEdgesAndVertexConcatenationAsKey[key]); }
/// <param name="pathFactory"> /// used for creating an instance of Path{E, V, W}. /// See <see cref="PathFactory"/> /// </param> /// <param name="edgesUsedForFindingTheWeightsBetweenVerticesInPath"></param> private PathParser( PathFactory <P, E, V, W> pathFactory, IList <E> edgesUsedForFindingTheWeightsBetweenVerticesInPath ) { this.pathFactory = pathFactory; // TODO: use input validator here when that branch has been merged into the same code base //this.edgesUsedForFindingTheWeightsBetweenVerticesInPath = edgesUsedForFindingTheWeightsBetweenVerticesInPath; mapWithEdgesAndVertexConcatenationAsKey = new Dictionary <string, E>(); foreach (E edge in edgesUsedForFindingTheWeightsBetweenVerticesInPath) { string key = EdgeGenericsImpl <V, W> .CreateEdgeIdValue(edge.StartVertex.VertexId, edge.EndVertex.VertexId); mapWithEdgesAndVertexConcatenationAsKey.Add(key, edge); } }
public string GetEdgeId(string startVertexId, string endVertexId) { return(EdgeGenericsImpl <Vertex, Weight> .CreateEdgeIdValue(startVertexId, endVertexId)); }
public E CreateEdge(V startVertex, V endVertex, W weight) { EdgeGenerics <V, W> edge = EdgeGenericsImpl <V, W> .CreateEdgeGenerics(startVertex, endVertex, weight); return((E)edge); }