/// <inheritdoc /> public bool TryGetInEdges(TVertex vertex, out IEnumerable <SReversedEdge <TVertex, TEdge> > edges) { if (OriginalGraph.TryGetOutEdges(vertex, out IEnumerable <TEdge> outEdges)) { edges = EdgeExtensions.ReverseEdges <TVertex, TEdge>(outEdges); return(true); } edges = null; return(false); }
/// <inheritdoc /> public bool TryGetEdges(TVertex source, TVertex target, out IEnumerable <SReversedEdge <TVertex, TEdge> > edges) { if (OriginalGraph.TryGetEdges(target, source, out IEnumerable <TEdge> originalEdges) && ContainsVertex(source)) { edges = originalEdges.Select(edge => new SReversedEdge <TVertex, TEdge>(edge)); return(true); } edges = null; return(false); }
/// <summary> /// Execute filters on the current logic core graph. Can be undone by PopFilters() or can be made permanent by ApplyFilters(). /// </summary> public void PushFilters() { int i = 0; IsFilterRemoved = false; //remember original graph if we're about to start filtering if (Filters.Count > 0 && !IsFiltered) { OriginalGraph = Graph.CopyToGraph <TGraph, TVertex, TEdge>(); } //reset graph if we remove filtering else if (Filters.Count == 0 && IsFiltered) { PopFilters(); } while (Filters.Count > 0) { //start applying filter on original graph copy on the 1st pass and then on Graph property each other pass Graph = Filters.Dequeue().ProcessFilter(i == 0 ? OriginalGraph.CopyToGraph <TGraph, TVertex, TEdge>() : Graph); i++; IsFiltered = true; } }
/// <inheritdoc /> public bool ContainsEdge(TVertex source, TVertex target) { return(OriginalGraph.ContainsEdge(target, source)); }
/// <inheritdoc /> public bool ContainsEdge(SReversedEdge <TVertex, TEdge> edge) { return(OriginalGraph.ContainsEdge(edge.OriginalEdge)); }
/// <inheritdoc /> public int Degree(TVertex vertex) { return(OriginalGraph.Degree(vertex)); }
/// <inheritdoc /> public bool IsInEdgesEmpty(TVertex vertex) { return(OriginalGraph.IsOutEdgesEmpty(vertex)); }
/// <inheritdoc /> public SReversedEdge <TVertex, TEdge> InEdge(TVertex vertex, int index) { return(new SReversedEdge <TVertex, TEdge>( OriginalGraph.OutEdge(vertex, index))); }
/// <inheritdoc /> public IEnumerable <SReversedEdge <TVertex, TEdge> > InEdges(TVertex vertex) { return(EdgeExtensions.ReverseEdges <TVertex, TEdge>(OriginalGraph.OutEdges(vertex))); }