Find an algorithm with a time complexity of O (MN) for the smallest circle in the graph

Source: Internet
Author: User

Find an algorithm with a time complexity of O (MN) for the smallest circle in the graph
This paper presents an algorithm for finding an O (MN) time complexity of the smallest forward loop in a forward graph with a n-point M-bar and no negative-length-to-loop direction, which is an improvement over the best time-bound O (mn+n^2 loglogn).
This algorithm first finds a circle with a minimum average length of λ^* within the O (MN) time complexity, so it chooses the point potential function to make the cost savings λ^* or larger. The algorithm then solves the shortest-path problem between all pairs of points, but then focuses on the shortest short-circuit with a maximum length of nλ^*, accelerating the calculation of the shortest-circuit time of each source point to O (M) so that all point times are calculated to O (MN).
At the same time, the experiment of this algorithm and the existing algorithm of finding the least direction circle in the graph is also carried out and compared. The experimental results show that the proposed algorithm is more advantageous than solving the shortest-path problem when solving the problem of the smallest tangential circle. The analysis shows that it is much faster to solve the problem of minimum tangential circle than the average O (n^2) time.
One: Introduction
We find the smallest circle (MLDC) in a direction graph with n points M-bar and no negative length with a forward circle. FLOYD[8] and warshall[19] solve the problem in O (n^3) time complexity. One option is to find the shortest path between all pairs of points. If there is a negative arc in the figure, with the correction marking algorithm to solve the first shortest-circuit problem, therefore, the cost can be used to convert the problem to a non-negative length of the problem, after the n-1 of the shortest possible problem can be solved with the Dijkstra ' s algorithm. Using Fredman and TARJAN[10] algorithms to solve the shortest-circuit problem, the operating time is O (mn+n^2 logn). PETTIS[17] Provides an improved algorithm for sparse graphs in O (mn+n^2 loglogn) time. Based on the results of Itai and rodeh[13], Roditty and williams[18] use a fast matrix product, and for an integer with a weighted [-m,m] in the direction graph, an algorithm is introduced to solve the mn^2.376 problem in the O (MLDC) time complexity, But not very practical.
The Algorithm of O (MN) To solve the MLDC problem is now elaborated. The algorithm improves the other combinatorial algorithms, and is the best strong polynomial time boundary, and its running time reaches the time bounds of the bellman[2], ford[9] and moore[15] algorithms to detect negative loops. The algorithm first uses the O (MN) algorithm of karp[14] to calculate the minimum average loop (MMC) problem. After using the point potential to fix the cost, it realizes the problem of calculating the shortest path of n single source points, in which the length is the minimum average length of the circle of nλ^*,λ^*. n points, the shortest-circuiting calculation of each single source point can be resolved in O (m) time with the Dijkstra ' s algorithm performed in dial[6], so that the algorithm of O (MN) Time complexity can be obtained for MLDC problems.
There is an illuminating evidence that it is difficult to solve the MLDC problem faster than O (MN), assuming that there is a MLDC optimal ring W, to prove the optimality of W, it is necessary to prove that any point j∈w, the minimum circle containing j is at least C (W), which requires Ω (n) calculation, each of which requires Ω (m) step, So there is a total of Ω (MN) steps required. This is a comparison with the MMC issue for MLDC. Currently the best strong polynomial time complexity for MMC is O (MN), however, you can quickly prove that W is the optimal solution for MMC problems. Λ^* is the average length of the circle W, p is the point potential function in lemma 1, then the cost savings per side of W is λ^*, and the cost savings for the other sides of figure g are at least λ^*. This illustrates the optimality of W in the Time of O (M), and also provides the possibility of resolving MMC problems faster than O (MN).
Research on the MMC algorithm has been studied by Dasdan et al. [4],dasdan[3], and Georgiadis et al. [11]. This article is mainly for the experimental study of MLDC algorithm, so far, this is the only experimental study of the MLDC algorithm. Experiments show that the average situation of the algorithm is much faster than the worst-case O (MN) time complexity.
In this article, we rely on the howard[12] algorithm to find MMC. The Howard algorithm is more effective in practice. After using the point potential to fix the cost, it realizes the problem of calculating the shortest path of n single source points, in which the length is the minimum average length of the circle of nλ^*,λ^*. n points, the shortest-circuiting calculation of each single source point can be resolved in O (m) time with the Dijkstra ' s algorithm performed in dial[6], so that the algorithm of O (MN) Time complexity can be obtained for MLDC problems. For most of our experiments, it is true that the MMC problem can speed up overall uptime, but the time to resolve MMC problems is a major bottleneck, and it takes longer to run than to solve all the shortest-path problems.
Second, the initial result of the smallest forward circle.
Given the direction graph g= (v,a), V={1, 2?n},a for the M arc, for the i∈v,γ_i^+={j∈v│ (I,J) ∈a} is the successor of Point I, γ_i^-={j∈v│ (j,i) ∈a} is the first point of I, for? (I,J) ∈a,c_ij∈r represents the cost of its length, sometimes referred to as an arc (I,J). The P_st from point s to T is sequence? I_1, (i_1,i_2), i_2? (I_ (L-1), i_l), i_l?, satisfies I_1=s,i_l=t,?1≤ω≤l-1, (I_ (ω-1), i_ω) ∈a, with the length of the road is all arc length and the point i_1 to the I_r has the direction of the arc (i_r,i_1) constitute the ring, C (W) =∑_ ( (i,j) ∈w)? C_ij indicates the length of the circle W, MLDC is the problem of the direction of the minimum length, if G does not contain a negative length and has at least one Direction ring is called MLDC problem is feasible. For each lap w,λ (W) =c (W)/| w| Represents the average length of the circle W, the MMC represents a forward loop that determines the minimum average length, w^* represents the optimal solution for MMC, λ^*=λ (w^*), and the graph is strongly connected if any of the two points in the graph can reach each other. The strongly connected branch of Figure G is the largest strongly connected sub-graph of G.
Lemma 1 is well known, for example can be known from Ahuja et al.[1].
Lemma 1:w^* represents the optimal solution of a strongly connected graph g= (v,a) MMC, λ^*=λ (w^*), by making c_ij^ ' =c_ij-λ^*, (i,j) ∈a, by G get g^ ', P (i) is g^ ' in the shortest length from point 1 to I,? (I,J) ∈a, cost-saving is c_ij^p=c_ij+p (i)-P (j) =c_ij^ ' +p (i)-P (j) +λ^*, then there is: (1): Any of the positive ring W in G has C (W) =c^p (W). (2):? (i,j) ∈a,c_ij^p≥λ^*,? (i,j) ∈w,c_ij^p=c_ij+p (i)-P (j) =c_ij+λ^*〖-c_ij=λ〗^*.
The algorithm of karp[14] is used to determine the λ^* and P in the O (MN) time complexity, known by the Lemma 1, MLDC with the cost of C in G with the MLDC problem of the cost of c^p. For each pair of vertex pairs i,j, calculate the shortest length d^p (i,j) from point I to points J and Arc c^p. The smallest circle can be found by Min{d^p (I,J) +c_ji^p: (j,i) ∈a}. Solving the MLDC problem by solving the shortest-path problem of all point pairs is well known. Because D^p (i,j) ≤c^p (w^*) =c (w^*) =λ^* | w^* |, the process of calculating P can be accelerated by seeking d^p (I,J).
Third, in O (MN) time complexity to determine the N shortest path to solve the MLDC problem.
Assuming c=c^p,d=d^p, consider figure G, where each arc length c_ij≥λ^*, with the S point to represent the source point of the Dijkstra's algorithm, the shortest way from S point to J Point D^p (S,j) < (| w^* |-1) λ^*, the length of each circle containing the arc (k,s) is at least D (s,k) +c_ks, thus having C (w^*) =λ^* | w^* |.
We use the Dijkstra ' s [7] algorithm's DIAL[6] variable, which occupies at most | w^* |-1 A storage bucket, taking the dial algorithm developed by Denardo and Fox[5] to accelerate the calculation. It is assumed that in some iterations, the shortest path from S point is obtained. The following implementation process is described below: d_s (j) Represents the current distance number of point J, so D_s (j) is a certain path length in G from S to Point J, so there is d_s (j) ≥d (S,j), D (S,j), which represents the shortest path length of the dot s to points J. Pred (j) Indicates the point S points J, the length of d_s (j) on the way to point J of the forward point. Set the initial value d_s (s) =0,d_s (j) =∞ (J≠s). The algorithm keeps a column | w^* |-1 a bucket, where the bucket K contains any point J that makes 〖kλ〗^*≤d_s (j) < (k+1) λ^*. d_s (s) =0 so point S is not in any of the buckets. When the shortest path is found from the point S, the point J is embedded in the appropriate bucket, which becomes an update to the point pair (s,j) bucket, as shown in the following procedure:
Procedure bucket-update (s,j) point pair (s,j) of the storage bucket update
The dial algorithm iterates over the point I, the first selected point is the point S, and then the algorithm chooses a little I from the smallest non-empty bucket, then deletes the point I from the bucket. You do not need to select the point I with the minimum distance number. If all the buckets are empty, stop looking for the smallest circle containing the point S. After selecting vertex I, the algorithm determines whether the ring formed from the point S to the road arc (I,s) of the points is the improvement of the current minimum lap, and then checks each arc from point I, for each browsed arc (i,s), so that d_s (j) =min{d_s (J), d_s (i) +c_ij}, and update pred (j) appropriately. If d_s (j) value drops, and d_s (j) <λ^* | w^* |, the algorithm checks if the point J is in the appropriate bucket, and if not, move it to the appropriate bucket.
The procedure for updating the distance designator is shown in 2. Figure 3 is an algorithm for finding the smallest forward loop with a point S. In this algorithm, the MLDC represents the length of the smallest forward loop currently found. Figure 4 is the entire algorithm for finding the smallest circle.
In the usual implementation of the Dial shortest path algorithm, a minimum distance designator is selected when a point I is selected from the bucket K. In the smallest circle containing the point S, it is possible to select any point from the bucket K, as the following results are in Denardo and fox[5]:
Lemma 2: d_s (j) =d (S,j) If Point J is any point in a non-empty bucket. This lemma can be inductive to prove that it relies on the following observations. The point j is stored in the bucket K, I is from the point S to the J Road J on the front of the point, then D (s,i) ≤d_s (j)-λ^*, so points I can be selected from some b<k bucket b
Theorem 1: Minimum forward loop algorithm with point S can determine accurately if there is a length less than λ^* in O (m) time | w^* | And a forward circle containing the point S. The proof idea is: by lemma 1, the algorithm coincides with the point S, the longest road length is (| w^* |-1) λ^* is consistent with the shortest path problem, so it determines the length of the maximum of λ^* | w^* | and contains the smallest forward circle of the point S. While browsing an arc and updating the distance designator and the bucket requires O (1) time, it takes a total of O (m) time. The time to confirm that the minimum non-empty bucket is O (n) is because the label of the smallest non-empty bucket is not dropped during the iteration, and a maximum of one empty bucket is browsed at a time, in the selection operation, the average time for each point to produce the vertex is O (1), so the total time is O (n). Therefore, the algorithm run Time is O (m) when navigating from point S.
Theorem 2: In Figure G, the algorithm mldc can calculate the smallest forward loop in the time complexity of O (MN). An O (MN) time is required to calculate MMC problems using the karp[14] algorithm. The distance p can also be obtained in O (MN) time. Thus, by the theorem 1, n independent of the shortest-path problem can be obtained in O (m), thus, the MLDC algorithm can be calculated in O (MN) time complexity.
A series of practical improvements can be included in the algorithm when accelerating in the experiment. These improvements have no effect on the worst-case uptime, except for the Howard algorithm, which solves the MMC problem, and it does reduce the worst run time. (1) using the Howard algorithm algorithm to solve MMC problem in practice. We also implemented the Ahuja and Orlin scaling simplicity algorithm, which ran at O (MNLOGNC), and was similar to the Howard algorithm, but the Howard algorithm was faster, so the Howard algorithm was applied to the experiment to accelerate the operation. (2) using integer arithmetic. In the calculation of MLDC problem, for the problem instance with the distance marking of the seasonal c_ij-λ^* instead of C_ij, the initial arc length in the experiment is an integer, then the λ^* is the rational number, and the denominator number is less than N, in order to avoid the fractional arc length, with the λ^* to multiply the initial arc length, This translates the original problem into an equivalent integer problem. (3) Stop the calculation after the MMC is calculated. If the minimum average circle w^* only two arcs, it is a minimum circle. If there are only three arcs in the w^*, it is the smallest arc or the smallest circle with only two arcs, while the latter only needs to check all two arc rings, which requires O (m) time. (4) Limiting the algorithm to a strongly connected branch can accelerate the time, because the strongly connected branch can be calculated periodically. In practice, consider the following acceleration suggestions: 1: Remove the point with subscript less than S. For S∈[1,n], the incident arc of the point S and Point S is permanently deleted when the smallest forward loop containing the point S is implemented. 2: Delete source and sink points. The algorithm records the degrees and degrees of each point, permanently deleting a point with a degree of 0. 3: Delete the large-length arc. Use MLDC to represent the smallest circle in a given iteration, permanently deleting an arc with a length of at least mldc-λ^*, because the arc cannot appear in the shortest path. 4: Initializes the vector of the distance designator. Before calculating the shortest circuit of the first source point, this constant amount is set to mldc-λ^* at each position, and when the shortest path from a given point is found, the corrected dynamic distance label contains the label of each distance up to mldc-λ^*. Before the next source point is selected, the distance label for the point is reset to mldc-λ^*, and the dynamic label becomes empty.
Iv. Results of the experiment
4.1 Algorithm
(1) Floyd and Warshall algorithm (FW algorithm). D^k [I,j] denotes point {i,j}? The shortest path length of point I to points J on {1,2?k-1} has the following recursive relationship: D^k [i,j]=min{d^k [I,j],d^k [I,k]+d^k]}, for fixed k,j changes, you can no longer calculate k,i,j [D^k] Part of the ≥MLDC acceleration calculation.
(2) Bheap (binary heap algorithm). When the graph contains a negative length, the initial optimal distance is calculated with pollotino[16], and the remaining shortest-path tree is calculated using the two-fork heap of the Dijkstra ' s algorithm, so the heap operation requires a log (size (heap)) time, and the calculation is limited to a strong connected branch than the point s subscript large, The distance designator is less than the arc of MLDC. In addition, consider the simultaneous execution of the Dijkstra ' s algorithm. When the minimum distance between the two directions of a point is less than MLDC, the BHEAP algorithm is encoded into the BBHEAP algorithm.
(3) in the algorithm called OSN, there are 6 variable, by multiplying and dividing by | w^* | All operations are equivalent to arithmetic on the whole hour.
(4) for the leaky bucket algorithm called OSNB, the first step is to use a two-way association list to store the bucket, can be completed in O (1) time to delete. When the bucket k is the smallest indicator bucket, the first element of the bucket K is deleted, and the first element is deleted when Point J is moved from the bucket k to a lower indicator's bucket. The second case requires a two-way list.
(5) Relaxed leaky bucket algorithm (OSNBL). In the slack leaky bucket algorithm, a one-way list is used to implement the bucket and the relaxation deletion method is used: If Point J is moved from the bucket k to a lower indicator's bucket, point J is added to the lower indicator's bucket, but the point J is not removed from the bucket K.
(6) In the execution of a known osnh, a binary heap is used to perform the shortest path algorithm. The difference between OSNH and Bheap is that the former first used the Howard algorithm to solve MCC and fixed the distance, Bheap did not solve the MCC problem.
The last three operations are the same as the previous three, except for the bidirectional version of the Dijkstra ' s algorithm, called BOSNB, BOSNBL, BOSNH, respectively.
4.2 Test Examples
The first set of instances is generated by the Netgen generator, generates random n∈{8000,16000?256000},m∈{2n,4n?128n}, the following parameters are fixed, the source point is 1, the meeting point is the 1,t source point =t The meeting point = 0, the minimum cost is 1, the maximum cost is 10000, Each combination of N and M produces 10 copies, producing a total of 420 different instances. The second set of instances is generated by Gridgen, when n changes from 8000 to 256000, the breadth of the graph belongs to the set {2,4,,128}, the following parameters are fixed, the source point is 1, the meeting point is 1, the average is equal to the breadth, the minimum cost is 1, the maximum cost is 10000, each n and M combination, Produces 11 copies, generating 462 different instances altogether. The third set of instances is generated by Hpgen, which first constructs an optional Hamiltonian path of length in [1,10], and the remaining m-n+1 arcs are determined by randomly selected point pairs, arc lengths are selected in the [1,10000] interval, generate random plots, N and M are identical to the first group, each pair of combinations produces 10 copies, A total of 420 different instances are generated. All arc lengths in the test are non-negative.
4.3 results
1:floyd and Warshall algorithm (FW algorithm) are not competitive with other algorithms.
The bidirectional deformation of the 2:dijkstra ' s algorithm does not substantially increase the run time.
3:BOSNB, BOSNBL is the fastest of the 6-step execution of OSN, and is faster than the two-step execution of the BHEAP algorithm.
BOSNB and BOSNBL Run the same time, BOSNB than OSNH running time faster 10%--30%. BOSNB runs faster than Bheap, bheap is progressively faster.
4: Running the Howard algorithm in an experiment will shorten the time to resolve MLDC instances, although the Howard algorithm is still a hindrance to operations.
5: Bheap is faster than BOSNB when the density d=m/n value of the graph is small, but when the D value is large, the opposite is the case. The increase in D leads to increased uptime, but the doubling of D does not result in a doubling of the CPU uptime of any algorithm, and the Howard algorithm is far less sensitive to D-values than the BHEAP algorithm.
6: Regression analysis provides a good estimate of the uptime of the Howard algorithm and Bosnb-h, and gives an excellent estimate of the bheap run time.
7:BOSNB and Bheap will solve MLDC problems clearly and quickly than the worst-case scenario presented. Review the worst case analysis of the MLDC problem is O (MN), Bheap run time is O (Mnlogn), if the Bheap regression analysis is very large for n,m is accurate, with the D value instead of m/n, then bheap in actual run time will be as follows: For Netgen instance is O (n^ m^73) The Gridgen instance is O (n^5 m^76), and the Hpgen instance is O (n^46 m^87), which in each case is much faster than the worst run time.
: Five, summary
Our preliminary theoretical result is a faster algorithm for solving the problem of the smallest circle in the graph, and we have improved it to the O (MN) time complexity based on the original best time O (mn+n^2 Loglogn) to solve the problem.
In our calculations, we rely on the Howard algorithm to solve MMC problems. In general, solving the problem of averaging before solving the least-lap problem does result in faster running times for instances generated by three generators in Netgen, Gridgen, Hpgen. This acceleration requires browsing to determine the number of points that each of the shortest-circuiting calculations can be implemented. However, by the results of the experiment, when N>1000000,d is very small, it seems to be possible to skip the results of MMC, which seems to be better results.
At the same time, it can be observed that the two-way version of the Operation Dijkstra ' s algorithm to solve the MLDC problem can lead to a slight increase in uptime. One surprising and significant result: The Howard algorithm is a bottleneck in solving mldc problems even though the Howard algorithm is much faster than O (MN) time complexity in the real cloud. Speeding up the MMC run time can lead to a corresponding improvement in the uptime of the MLDC problem.
Vi. Reference Documents
1. Ahuja, R., Magnanti, T., & Orlin, J.B., (1993). Network flows, Prentice-hall, Inc.
2. Bellman, R., (1958). On a Route problem. Quart. Appl. Math. 16, 87-90.
3. Dasdan, A., (2004). Experimental analysis of the fastest Optimum Cycle Ratio and Mean algorithms. ACM transactions on Design Automation of Electronic Systems 9 (4), 385-418.
4. Dasdan, A., Irani, S., & Gupta, R.k., (1999). Efficient algorithms for Optimum Cycle Mean and Optimum cost to time Ratio problem. In Proceedings of the 36th Design Automation Conference.
5. Denardo, e.v and Fox, B.l. (1979). Shortest-route methods:1. Reaching, pruning, and buckets. Operations 27-1, 161-186.
6. Dial, R.b., (1969). Algorithm 360:shortest Path Forest with topological ordering. Communications of the ACM 12, 632-633.
7. Dijkstra., E.w., (1959). A Note on the problems in Connection with Graphs. Number. Math. 1, 269-271.
8. Floyd, R.W., (1962). Algorithm 97:shortest path. Comm. ACM 5, 345.
9. Ford, L.R, (1956). Network Flow theory, the Rand Corporation report P-923, SANTA Monica, Calif.
Fredman, M.L & Tarjan, R.E., (1987). Fibonacci heaps and their uses in improved network optimization algorithms. Journal of the ACM (JACM) 34-3, 596-615.
Georgiadis, L., Goldberg, A.V, Tarjan, R.E., & Werneck, R. F., (2009). An experimental study of minimum mean cycle algorithms. In Proceedings of the 11th Workshop on algorithm Engineering and Experiments (Alenex). SIAM, Philadelphia, 1-13.
Howard, R.A. (1960). Dynamic programming and Markov Processes. The M.I.T Press, Cambridge, Mass.
Itai, A., & Rodeh, M., (1978). Finding a minimum circuit in a graph. SIAM J. Computing 7 (4), 413-423.
Karp, R.m., (1978). A characterization of the minimum cycle mean in a digraph. Discrete Mathematics 23, 309-11.
Moore, M.H, (1976). The fastest route for Convoy-type traffic in flow rate-constrained networks. Transportation science,10 (2), 113-124.
Pallottino, S., (1984). Shortest-path methods:complexity, In-terrelations and New propositions. Networks 14, 257-267.
Pettie, S., (2004). A New approach to all-pairs shortest paths on real-weighted graphs. Theoretical Computer Science 312 (1), 47-74.
Roditty, L. & Williams, V.V. (2011). Minimum weight cycles and triangles:equivalences and algorithms. Arxiv:1104.2882v1 APR 2011.
Warshall, S., (1962). A theorem on Boolean matrices. Journal of the ACM 9 (1), 11-12.

Find an algorithm with a time complexity of O (MN) for the smallest circle in the graph

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.