public void AddEdge(TVertex origin, TVertex destination, TEdge edge) { if (origin == null) { throw new ArgumentNullException(nameof(origin)); } if (destination == null) { throw new ArgumentNullException(nameof(destination)); } if (edge == null) { throw new ArgumentNullException(nameof(edge)); } if (!VertexConnectionCollections.ContainsKey(origin)) { AddVertex(origin); } if (!VertexConnectionCollections.ContainsKey(destination)) { AddVertex(destination); } VertexConnectionCollections[origin].AddSuccessor(destination, edge); VertexConnectionCollections[destination].AddPredecessor(origin, edge); }
public IEnumerable <TVertex> SuccessorVertices(TVertex vertex) { if (vertex == null) { throw new ArgumentNullException(nameof(vertex)); } if (!VertexConnectionCollections.ContainsKey(vertex)) { throw new ArgumentException(); } return(VertexConnectionCollections[vertex].SuccessorVertices); }
public int Outdegree(TVertex vertex) { if (vertex == null) { throw new ArgumentNullException(nameof(vertex)); } if (!VertexConnectionCollections.ContainsKey(vertex)) { throw new ArgumentException(); } return(VertexConnectionCollections[vertex].Outdegree); }
public IEnumerable <IUnweightedEndpoint <TVertex> > AdjacentEndpoints(TVertex vertex) { if (vertex == null) { throw new ArgumentNullException(nameof(vertex)); } if (!VertexConnectionCollections.ContainsKey(vertex)) { throw new ArgumentException(); } return(VertexConnectionCollections[vertex].AdjacentEndpoints); }
public IEnumerable <TEdge> IncidentEdges(TVertex vertex) { if (vertex == null) { throw new ArgumentNullException(nameof(vertex)); } if (!VertexConnectionCollections.ContainsKey(vertex)) { throw new ArgumentException(); } return(VertexConnectionCollections[vertex].IncidentEdges); }
public IEnumerable <IWeightedEndpoint <TVertex, TEdge> > SuccessorEndpoints(TVertex vertex) { if (vertex == null) { throw new ArgumentNullException(nameof(vertex)); } if (!VertexConnectionCollections.ContainsKey(vertex)) { throw new ArgumentException(); } return(VertexConnectionCollections[vertex].SuccessorEndpoints); }
public IEnumerable <TEdge> IncidentEdgesConnecting(TVertex origin, TVertex destination) { if (origin == null) { throw new ArgumentNullException(nameof(origin)); } if (destination == null) { throw new ArgumentNullException(nameof(destination)); } if (!VertexConnectionCollections.ContainsKey(origin)) { throw new ArgumentException(); } if (!VertexConnectionCollections.ContainsKey(destination)) { throw new ArgumentException(); } return(VertexConnectionCollections[origin].IncidentEdgesConnecting(destination)); }