/// <summary>
 /// Initializes a new instance of the <see cref="EulerianTrailAlgorithm{TVertex,TEdge}"/> class.
 /// </summary>
 /// <param name="host">Host to use if set, otherwise use this reference.</param>
 /// <param name="visitedGraph">Graph to visit.</param>
 public EulerianTrailAlgorithm(
     IAlgorithmComponent host,
     IMutableVertexAndEdgeListGraph <TVertex, TEdge> visitedGraph)
     : base(host, visitedGraph)
 {
     _currentVertex = default(TVertex);
 }
 public ImplicitEdgeDepthFirstSearchAlgorithm(
     IAlgorithmComponent host,
     IIncidenceGraph <TVertex, TEdge> visitedGraph
     )
     : base(host, visitedGraph)
 {
 }
Example #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DepthFirstSearchAlgorithm{TVertex,TEdge}"/> class.
 /// </summary>
 /// <param name="host">Host to use if set, otherwise use this reference.</param>
 /// <param name="visitedGraph">Graph to visit.</param>
 /// <param name="verticesColors">Vertices associated to their colors (treatment states).</param>
 /// <exception cref="T:System.ArgumentNullException"><paramref name="visitedGraph"/> is <see langword="null"/>.</exception>
 /// <exception cref="T:System.ArgumentNullException"><paramref name="verticesColors"/> is <see langword="null"/>.</exception>
 public DepthFirstSearchAlgorithm(
     [CanBeNull] IAlgorithmComponent host,
     [NotNull] IVertexListGraph <TVertex, TEdge> visitedGraph,
     [NotNull] IDictionary <TVertex, GraphColor> verticesColors)
     : this(host, visitedGraph, verticesColors, edges => edges)
 {
 }
Example #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UndirectedDepthFirstSearchAlgorithm{TVertex,TEdge}"/> class.
 /// </summary>
 /// <param name="host">Host to use if set, otherwise use this reference.</param>
 /// <param name="visitedGraph">Graph to visit.</param>
 /// <param name="verticesColors">Vertices associated to their colors (treatment states).</param>
 public UndirectedDepthFirstSearchAlgorithm(
     IAlgorithmComponent host,
     IUndirectedGraph <TVertex, TEdge> visitedGraph,
     IDictionary <TVertex, GraphColor> verticesColors)
     : this(host, visitedGraph, verticesColors, edges => edges)
 {
 }
Example #5
0
 /// <summary>
 /// Initializes a new instance of the algorithm.
 /// </summary>
 /// <param name="host">algorithm host</param>
 /// <param name="visitedGraph">visited graph</param>
 public DepthFirstSearchAlgorithm(
     IAlgorithmComponent host,
     AdjacencyGraph <TVertex> visitedGraph
     )
     : this(host, visitedGraph, new Dictionary <TVertex, GraphColor>(), e => e)
 {
 }
Example #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UndirectedShortestPathAlgorithmBase{TVertex,TEdge}"/> class.
 /// </summary>
 /// <param name="host">Host to use if set, otherwise use this reference.</param>
 /// <param name="visitedGraph">Graph to visit.</param>
 /// <param name="edgeWeights">Function that computes the weight for a given edge.</param>
 /// <exception cref="T:System.ArgumentNullException"><paramref name="visitedGraph"/> is <see langword="null"/>.</exception>
 /// <exception cref="T:System.ArgumentNullException"><paramref name="edgeWeights"/> is <see langword="null"/>.</exception>
 protected UndirectedShortestPathAlgorithmBase(
     [CanBeNull] IAlgorithmComponent host,
     [NotNull] IUndirectedGraph <TVertex, TEdge> visitedGraph,
     [NotNull] Func <TEdge, double> edgeWeights)
     : this(host, visitedGraph, edgeWeights, DistanceRelaxers.ShortestDistance)
 {
 }
Example #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ShortestPathAlgorithmBase{TVertex,TEdge,TGraph}"/> class.
 /// </summary>
 /// <param name="host">Host to use if set, otherwise use this reference.</param>
 /// <param name="visitedGraph">Graph to visit.</param>
 /// <param name="edgeWeights">Function that computes the weight for a given edge.</param>
 protected ShortestPathAlgorithmBase(
     IAlgorithmComponent host,
     TGraph visitedGraph,
     Func <TEdge, double> edgeWeights)
     : this(host, visitedGraph, edgeWeights, DistanceRelaxers.ShortestDistance)
 {
 }
 public CloneableVertexGraphExplorerAlgorithm(
     IAlgorithmComponent host,
     IMutableVertexAndEdgeSet <TVertex, TEdge> visitedGraph
     )
     : base(host, visitedGraph)
 {
 }
 /// <summary>
 /// Initializes a new instance of the algorithm.
 /// </summary>
 /// <param name="host">algorithm host</param>
 /// <param name="visitedGraph">visited graph</param>
 public DepthFirstSearchAlgorithm(
     IAlgorithmComponent host,
     IVertexListGraph <TVertex, TEdge> visitedGraph
     )
     : this(host, visitedGraph, new Dictionary <TVertex, GraphColor>(), e => e)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="UndirectedDijkstraShortestPathAlgorithm{TVertex,TEdge}"/> class.
 /// </summary>
 /// <param name="host">Host to use if set, otherwise use this reference.</param>
 /// <param name="visitedGraph">Graph to visit.</param>
 /// <param name="edgeWeights">Function that computes the weight for a given edge.</param>
 /// <param name="distanceRelaxer">Distance relaxer.</param>
 public UndirectedDijkstraShortestPathAlgorithm(
     IAlgorithmComponent host,
     IUndirectedGraph <TVertex, TEdge> visitedGraph,
     Func <TEdge, double> edgeWeights,
     IDistanceRelaxer distanceRelaxer)
     : base(host, visitedGraph, edgeWeights, distanceRelaxer)
 {
 }
Example #11
0
 public MultiSourceSinkGraphAugmentorAlgorithm(
     IAlgorithmComponent host,
     IMutableBidirectionalGraph <TVertex, TEdge> visitedGraph,
     IVertexFactory <TVertex> vertexFactory,
     IEdgeFactory <TVertex, TEdge> edgeFactory)
     : base(host, visitedGraph, vertexFactory, edgeFactory)
 {
 }
Example #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BidirectionalDepthFirstSearchAlgorithm{TVertex,TEdge}"/> class.
 /// </summary>
 /// <param name="host">Host to use if set, otherwise use this reference.</param>
 /// <param name="visitedGraph">Graph to visit.</param>
 /// <param name="verticesColors">Vertices associated to their colors (treatment states).</param>
 public BidirectionalDepthFirstSearchAlgorithm(
     [CanBeNull] IAlgorithmComponent host,
     [NotNull] IBidirectionalGraph <TVertex, TEdge> visitedGraph,
     [NotNull] IDictionary <TVertex, GraphColor> verticesColors)
     : base(host, visitedGraph)
 {
     VerticesColors = verticesColors ?? throw new ArgumentNullException(nameof(verticesColors));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="EdgeDepthFirstSearchAlgorithm{TVertex,TEdge}"/> class.
 /// </summary>
 /// <param name="host">Host to use if set, otherwise use this reference.</param>
 /// <param name="visitedGraph">Graph to visit.</param>
 /// <param name="edgesColors">Edges associated to their colors (treatment states).</param>
 public EdgeDepthFirstSearchAlgorithm(
     [CanBeNull] IAlgorithmComponent host,
     [NotNull] IEdgeListAndIncidenceGraph <TVertex, TEdge> visitedGraph,
     [NotNull] IDictionary <TEdge, GraphColor> edgesColors)
     : base(host, visitedGraph)
 {
     EdgesColors = edgesColors ?? throw new ArgumentNullException(nameof(edgesColors));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="AllVerticesGraphAugmentorAlgorithm{TVertex,TEdge}"/> class.
 /// </summary>
 /// <param name="host">Host to use if set, otherwise use this reference.</param>
 /// <param name="visitedGraph">Graph to visit.</param>
 /// <param name="vertexFactory">Vertex factory method.</param>
 /// <param name="edgeFactory">Edge factory method.</param>
 public AllVerticesGraphAugmentorAlgorithm(
     IAlgorithmComponent host,
     IMutableVertexAndEdgeSet <TVertex, TEdge> visitedGraph,
     VertexFactory <TVertex> vertexFactory,
     EdgeFactory <TVertex, TEdge> edgeFactory)
     : base(host, visitedGraph, vertexFactory, edgeFactory)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="BreadthFirstSearchAlgorithm{TVertex,TEdge}"/> class.
 /// </summary>
 /// <param name="host">Host to use if set, otherwise use this reference.</param>
 /// <param name="visitedGraph">Graph to visit.</param>
 /// <param name="vertexQueue">Queue of vertices to treat.</param>
 /// <param name="verticesColors">Vertices associated to their colors (treatment states).</param>
 public BreadthFirstSearchAlgorithm(
     IAlgorithmComponent host,
     IVertexListGraph <TVertex, TEdge> visitedGraph,
     IQueue <TVertex> vertexQueue,
     IDictionary <TVertex, GraphColor> verticesColors)
     : this(host, visitedGraph, vertexQueue, verticesColors, edges => edges)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="WeaklyConnectedComponentsAlgorithm{TVertex,TEdge}"/> class.
 /// </summary>
 /// <param name="host">Host to use if set, otherwise use this reference.</param>
 /// <param name="visitedGraph">Graph to visit.</param>
 /// <param name="components">Graph components.</param>
 public WeaklyConnectedComponentsAlgorithm(
     IAlgorithmComponent host,
     IVertexListGraph <TVertex, TEdge> visitedGraph,
     IDictionary <TVertex, int> components)
     : base(host, visitedGraph)
 {
     Components = components ?? throw new ArgumentNullException(nameof(components));
 }
Example #17
0
 protected ShortestPathAlgorithmBase(
     IAlgorithmComponent host,
     TGraph visitedGraph,
     IDictionary <TEdge, double> weights
     )
     : this(host, visitedGraph, weights, new ShortestDistanceRelaxer())
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="RankedShortestPathAlgorithmBase{TVertex,TEdge,TGraph}"/> class.
 /// </summary>
 /// <param name="host">Host to use if set, otherwise use this reference.</param>
 /// <param name="visitedGraph">Graph to visit.</param>
 /// <param name="distanceRelaxer">Distance relaxer.</param>
 protected RankedShortestPathAlgorithmBase(
     [CanBeNull] IAlgorithmComponent host,
     [NotNull] TGraph visitedGraph,
     [NotNull] IDistanceRelaxer distanceRelaxer)
     : base(host, visitedGraph)
 {
     DistanceRelaxer = distanceRelaxer ?? throw new ArgumentNullException(nameof(distanceRelaxer));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="PrimMinimumSpanningTreeAlgorithm{TVertex,TEdge}"/> class.
 /// </summary>
 /// <param name="host">Host to use if set, otherwise use this reference.</param>
 /// <param name="visitedGraph">Graph to visit.</param>
 /// <param name="edgeWeights">Function that computes the weight for a given edge.</param>
 /// <exception cref="T:System.ArgumentNullException"><paramref name="visitedGraph"/> is <see langword="null"/>.</exception>
 /// <exception cref="T:System.ArgumentNullException"><paramref name="edgeWeights"/> is <see langword="null"/>.</exception>
 public PrimMinimumSpanningTreeAlgorithm(
     [CanBeNull] IAlgorithmComponent host,
     [NotNull] IUndirectedGraph <TVertex, TEdge> visitedGraph,
     [NotNull] Func <TEdge, double> edgeWeights)
     : base(host, visitedGraph)
 {
     _edgeWeights = edgeWeights ?? throw new ArgumentNullException(nameof(edgeWeights));
 }
Example #20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DagShortestPathAlgorithm{TVertex,TEdge}"/> class.
 /// </summary>
 /// <param name="host">Host to use if set, otherwise use this reference.</param>
 /// <param name="visitedGraph">Graph to visit.</param>
 /// <param name="edgeWeights">Function that computes the weight for a given edge.</param>
 /// <param name="distanceRelaxer">Distance relaxer.</param>
 public DagShortestPathAlgorithm(
     IAlgorithmComponent host,
     IVertexListGraph <TVertex, TEdge> visitedGraph,
     Func <TEdge, double> edgeWeights,
     IDistanceRelaxer distanceRelaxer)
     : base(host, visitedGraph, edgeWeights, distanceRelaxer)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CyclePoppingRandomTreeAlgorithm{TVertex,TEdge}"/> class.
 /// </summary>
 /// <param name="host">Host to use if set, otherwise use this reference.</param>
 /// <param name="visitedGraph">Graph to visit.</param>
 /// <param name="edgeChain">Edge chain strategy to use.</param>
 public CyclePoppingRandomTreeAlgorithm(
     [CanBeNull] IAlgorithmComponent host,
     [NotNull] IVertexListGraph <TVertex, TEdge> visitedGraph,
     [NotNull] IMarkovEdgeChain <TVertex, TEdge> edgeChain)
     : base(host, visitedGraph)
 {
     EdgeChain = edgeChain ?? throw new ArgumentNullException(nameof(edgeChain));
 }
Example #22
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BellmanFordShortestPathAlgorithm{TVertex,TEdge}"/> class.
 /// </summary>
 /// <param name="host">Host to use if set, otherwise use this reference.</param>
 /// <param name="visitedGraph">Graph to visit.</param>
 /// <param name="edgeWeights">Function that computes the weight for a given edge.</param>
 /// <param name="distanceRelaxer">Distance relaxer.</param>
 /// <exception cref="T:System.ArgumentNullException"><paramref name="visitedGraph"/> is <see langword="null"/>.</exception>
 /// <exception cref="T:System.ArgumentNullException"><paramref name="edgeWeights"/> is <see langword="null"/>.</exception>
 /// <exception cref="T:System.ArgumentNullException"><paramref name="distanceRelaxer"/> is <see langword="null"/>.</exception>
 public BellmanFordShortestPathAlgorithm(
     [CanBeNull] IAlgorithmComponent host,
     [NotNull] IVertexAndEdgeListGraph <TVertex, TEdge> visitedGraph,
     [NotNull] Func <TEdge, double> edgeWeights,
     [NotNull] IDistanceRelaxer distanceRelaxer)
     : base(host, visitedGraph, edgeWeights, distanceRelaxer)
 {
 }
Example #23
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ConnectedComponentsAlgorithm{TVertex,TEdge}"/> class.
 /// </summary>
 /// <param name="host">Host to use if set, otherwise use this reference.</param>
 /// <param name="visitedGraph">Graph to visit.</param>
 /// <param name="components">Graph components.</param>
 /// <exception cref="T:System.ArgumentNullException"><paramref name="visitedGraph"/> is <see langword="null"/>.</exception>
 /// <exception cref="T:System.ArgumentNullException"><paramref name="components"/> is <see langword="null"/>.</exception>
 public ConnectedComponentsAlgorithm(
     [CanBeNull] IAlgorithmComponent host,
     [NotNull] IUndirectedGraph <TVertex, TEdge> visitedGraph,
     [NotNull] IDictionary <TVertex, int> components)
     : base(host, visitedGraph)
 {
     Components = components ?? throw new ArgumentNullException(nameof(components));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="MultiSourceSinkGraphAugmentorAlgorithm{TVertex,TEdge}"/> class.
 /// </summary>
 /// <param name="host">Host to use if set, otherwise use this reference.</param>
 /// <param name="visitedGraph">Graph to visit.</param>
 /// <param name="vertexFactory">Vertex factory method.</param>
 /// <param name="edgeFactory">Edge factory method.</param>
 /// <exception cref="T:System.ArgumentNullException"><paramref name="visitedGraph"/> is <see langword="null"/>.</exception>
 /// <exception cref="T:System.ArgumentNullException"><paramref name="vertexFactory"/> is <see langword="null"/>.</exception>
 /// <exception cref="T:System.ArgumentNullException"><paramref name="edgeFactory"/> is <see langword="null"/>.</exception>
 public MultiSourceSinkGraphAugmentorAlgorithm(
     [CanBeNull] IAlgorithmComponent host,
     [NotNull] IMutableBidirectionalGraph <TVertex, TEdge> visitedGraph,
     [NotNull] VertexFactory <TVertex> vertexFactory,
     [NotNull] EdgeFactory <TVertex, TEdge> edgeFactory)
     : base(host, visitedGraph, vertexFactory, edgeFactory)
 {
 }
Example #25
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AllVerticesGraphAugmentorAlgorithm{TVertex,TEdge}"/> class.
 /// </summary>
 /// <param name="host">Host to use if set, otherwise use this reference.</param>
 /// <param name="visitedGraph">Graph to visit.</param>
 /// <param name="vertexFactory">Vertex factory method.</param>
 /// <param name="edgeFactory">Edge factory method.</param>
 public AllVerticesGraphAugmentorAlgorithm(
     [CanBeNull] IAlgorithmComponent host,
     [NotNull] IMutableVertexAndEdgeSet <TVertex, TEdge> visitedGraph,
     [NotNull] VertexFactory <TVertex> vertexFactory,
     [NotNull] EdgeFactory <TVertex, TEdge> edgeFactory)
     : base(host, visitedGraph, vertexFactory, edgeFactory)
 {
 }
Example #26
0
 protected UndirectedShortestPathAlgorithmBase(
     IAlgorithmComponent host,
     IUndirectedGraph <TVertex, TEdge> visitedGraph,
     Func <TEdge, double> weights
     )
     : this(host, visitedGraph, weights, DistanceRelaxers.ShortestDistance)
 {
 }
 public DagShortestPathAlgorithm(
     IAlgorithmComponent host,
     IVertexListGraph <TVertex, TEdge> g,
     Func <TEdge, double> weights,
     IDistanceRelaxer distanceRelaxer
     )
     : base(host, g, weights, distanceRelaxer)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="HoffmanPavleyRankedShortestPathAlgorithm{TVertex,TEdge}"/> class.
 /// </summary>
 /// <param name="host">Host to use if set, otherwise use this reference.</param>
 /// <param name="visitedGraph">Graph to visit.</param>
 /// <param name="edgeWeights">Function that for a given edge provide its weight.</param>
 /// <param name="distanceRelaxer">Distance relaxer.</param>
 /// <exception cref="T:System.ArgumentNullException"><paramref name="visitedGraph"/> is <see langword="null"/>.</exception>
 /// <exception cref="T:System.ArgumentNullException"><paramref name="edgeWeights"/> is <see langword="null"/>.</exception>
 /// <exception cref="T:System.ArgumentNullException"><paramref name="distanceRelaxer"/> is <see langword="null"/>.</exception>
 public HoffmanPavleyRankedShortestPathAlgorithm(
     [CanBeNull] IAlgorithmComponent host,
     [NotNull] IBidirectionalGraph <TVertex, TEdge> visitedGraph,
     [NotNull] Func <TEdge, double> edgeWeights,
     [NotNull] IDistanceRelaxer distanceRelaxer)
     : base(host, visitedGraph, distanceRelaxer)
 {
     _edgeWeights = edgeWeights ?? throw new ArgumentNullException(nameof(edgeWeights));
 }
Example #29
0
 public EdmondsKarpMaximumFlowAlgorithm(
     IAlgorithmComponent host,
     IVertexListGraph <TVertex, TEdge> g,
     IDictionary <TEdge, double> capacities,
     IDictionary <TEdge, TEdge> reversedEdges
     )
     : base(host, g, capacities, reversedEdges)
 {
 }
 public EdmondsKarpMaximumFlowAlgorithm(
     IAlgorithmComponent host,
     IMutableVertexAndEdgeListGraph <TVertex, TEdge> g,
     Func <TEdge, double> capacities,
     EdgeFactory <TVertex, TEdge> edgeFactory
     )
     : base(host, g, capacities, edgeFactory)
 {
 }
Example #31
0
 public AlgorithmServices(IAlgorithmComponent host)
 {
     GraphContracts.AssumeNotNull(host, "host");
     this.host = host;
 }
Example #32
0
        public AlgorithmServices(IAlgorithmComponent host)
        {
            Contract.Requires(host != null);

            this.host = host;
        }