public void AddPredecessor(TVertex vertex, TEdge edge) { if (vertex == null) { throw new ArgumentNullException(nameof(vertex)); } if (edge == null) { throw new ArgumentNullException(nameof(edge)); } if (!InedgeCollections.ContainsKey(vertex)) { InedgeCollections[vertex] = new List <TEdge>(); } InedgeCollections[vertex].Add(edge); }
public IEnumerable <TEdge> IncidentEdgesConnecting(TVertex vertex) { if (vertex == null) { throw new ArgumentNullException(nameof(vertex)); } var incidentEdges = new List <TEdge>(); if (InedgeCollections.ContainsKey(vertex)) { incidentEdges.AddRange(InedgeCollections[vertex]); } if (OutedgeCollections.ContainsKey(vertex)) { incidentEdges.AddRange(OutedgeCollections[vertex]); } return(incidentEdges); }