/// <summary>
 /// 
 /// </summary>
 /// <param name="g"></param>
 /// <param name="capacities"></param>
 /// <param name="reversedEdges"></param>
 public EdmondsKarpMaximumFlowAlgorithm(
     IVertexListGraph g,
     EdgeDoubleDictionary capacities,
     EdgeEdgeDictionary reversedEdges
     )
     : base(g,capacities,reversedEdges)
 {
 }
 public PushRelabelMaximumFlowAlgorithm(IIndexedVertexListGraph g, EdgeDoubleDictionary capacities, EdgeEdgeDictionary reversedEdges)
     : base(g, capacities, reversedEdges)
 {
     this.visitedGraph = g;
     this.excessFlow = new VertexDoubleDictionary();
     this.current = new VertexIntDictionary();
     this.distances = new VertexIntDictionary();
 }
        public EdgeEdgeDictionary <TVertex, TEdge> Clone()
        {
            var clone = new EdgeEdgeDictionary <TVertex, TEdge>(this.Count);

            foreach (var kv in this)
            {
                clone.Add(kv.Key, kv.Value);
            }
            return(clone);
        }
		public void Init()
		{
			this.capacities = new EdgeDoubleDictionary();
			this.reversedEdges = new EdgeEdgeDictionary();
			this.graph = new AdjacencyGraph();

			this.source = graph.AddVertex();
			this.sink = graph.AddVertex();

			BuildSimpleGraph(source, sink);
		}
		/// <summary>
		/// 
		/// </summary>
		/// <param name="edgePredecessors"></param>
		/// <param name="endPathEdges"></param>
		public EdgePredecessorRecorderVisitor(
			EdgeEdgeDictionary edgePredecessors,
			EdgeCollection endPathEdges
			)
		{
			if (edgePredecessors==null)
				throw new ArgumentNullException("edgePredecessors");
			if (endPathEdges==null)
				throw new ArgumentNullException("endPathEdges");

			this.edgePredecessors = edgePredecessors;
			this.endPathEdges = endPathEdges;
		}
Example #6
0
		/// <summary>Constructs a maximum flow algorithm.</summary>
		/// <param name="g">Graph to compute maximum flow on.</param>
		/// <param name="capacities">edge capacities</param>
		/// <param name="reversedEdges">reversed edge map</param>
		/// <exception cref="ArgumentNullException"><paramref name="g"/> or
		/// <paramref name="capacities"/> or <paramref name="reversedEdges"/> is a null
		/// reference.
		/// </exception>
		public MaximumFlowAlgorithm(
			IVertexListGraph g,
			EdgeDoubleDictionary capacities,
			EdgeEdgeDictionary reversedEdges
			)
		{
			if (g==null)
				throw new ArgumentNullException("g");
			if (capacities==null)
				throw new ArgumentNullException("capacities");
			if (reversedEdges==null)
				throw new ArgumentNullException("reversedEdges");
		
			this.visitedGraph=g;
			this.capacities=capacities;
			this.reversedEdges=reversedEdges;
		
			this.predecessors=new VertexEdgeDictionary();
			this.residualCapacities=new EdgeDoubleDictionary();
			this.colors = new VertexColorDictionary();
        }
		/// <summary>
		/// Default constructor
		/// </summary>
		public EdgePredecessorRecorderVisitor()
		{
			edgePredecessors = new EdgeEdgeDictionary();
			endPathEdges = new EdgeCollection();
		}