10 classic algorithms in the graphic algorithm Field

Source: Internet
Author: User
10 classic algorithms in the graphic algorithm Field

FigureAlgorithm10 typical algorithms in the field

Author: July February 14, 2011.
Refer:
Wikipedia, 10 classic Algorithm Research Series in this blogArticle.

Bloggers:
1. This article includes all 20 important algorithms in the graphic algorithm field, and selects the top 10 algorithms.
2. The selection of the top ten algorithms is based on my personal opinion. The selection of other algorithms is not included in 10, but they are all mentioned in this article.
-------------------------------------------

Chapter 1: Basic Traversal
I. Deep Priority Search
2. breadth-first search
The two most basic algorithms in this graph traversal, BFS and DFS, are listed as the top 10 algorithms in this graph.
Because these two search algorithms are widely used and important.

For more information about the BFS and DFS algorithms, see:
Classical Algorithm Research Series: 4. How to thoroughly understand BFS and DFS Priority Search Algorithms
Http://blog.csdn.net/v_JULY_v/archive/2011/01/01/6111353.aspx

III. A * Search Algorithm
Both DFS and BFS are blind searches when expanding sub-nodes, that is,
It does not select which node is better in the next search and jumps to the node for the next search.
When you are not lucky, you need to test the complete solution set space. Obviously, it can only be applied to search problems with a small scale.

A * algorithm, as an important heuristic algorithm, is widely used in Optimal Path solving and policy design.
The most important part of a * algorithm lies in the design of a valuation function:
F (n) = g (n) + H (N)
F (n) is the valuation of every possible test point. It consists of two parts:
In part, g (n) indicates the cost from the start point to the current point (usually expressed by the depth of a node in the Search Tree ).
H (n) indicates the most important part in Heuristic Search, that is, the valuation of the current node to the target node.

For more information, see:
Classic Algorithm Research Series: 1. A * Search Algorithm
Http://blog.csdn.net/v_JULY_v/archive/2010/12/23/6093380.aspx

Appendix:
Flood fill
Leemars, wtzyb4446:
In Graphics, flood fill is filled with water and is used to fill areas.
It is like in a place until the water is fully stretched around until the ground stops.

Flood fill searches for the same point fill from one point to the surrounding until there are different points.
The flood fill we use is similar to this principle, which is a form of BFS.

Assume that one of the first drops of red ink in (I, j), and then the water begins to scatter and dye the upper and lower sides of it, that is (I-1, J), (I + 1, j), (I, J-1), (I, j + 1) these four points. then dye the surrounding area from these four points respectively... until it reaches a certain boundary.

The thought of converting this into BFS is that the initial element in the queue is (I, j), then the (I, j) extended state to get (I-1, J ), (I + 1, J), (I, J-1), (I, j + 1) these four states, join the queue. columns (I, j) and expands the next node... so

Chapter 2 shortest path algorithm
Iv. Dijkstra
Dijkstra algorithm, also known as Dijkstra ),
The algorithm solves the shortest path from a single source point to another vertex in the directed graph.

This Dijkstra algorithm has been described in two articles in this blog. For details, see:
I. Research Series of classical algorithms: II. Research on DIJKSTRA Algorithms
Http://blog.csdn.net/v_JULY_v/archive/2010/12/24/6096981.aspx
Ii. Classical Algorithm Research Series: Part 2: A thorough understanding of Dijkstra Algorithm
Http://blog.csdn.net/v_JULY_v/archive/2011/02/13/6182419.aspx

V. Bellman-Ford
Bellman-Ford:
To find the shortest path of a single source, you can determine whether there is a negative weight loop (If yes, there is no Shortest Path ),
Good timeliness, time complexity O (VE ).

Appendix:
Spfa:
It is the queue Optimization of Bellman-Ford, with relatively good timeliness and time complexity O (KE ). (K <v ).

6. Floyd-warshall
Floyd-warshall: Find the shortest path of multiple sources without negative weight edges. Use a matrix to record graphs. Poor timeliness, time complexity O (V ^ 3 ). This algorithm solves the shortest path between any two points. It can correctly handle the shortest path problem of directed graph or negative weight.

For more information, see:
Comparison of several Shortest Path Algorithms:
Http://blog.csdn.net/v_JULY_v/archive/2011/02/12/6181485.aspx

Appendix:Kneser Graph
A kneser graph is an algorithm related to the graph's fractional dyeing.
Given positive integers A, B, A ≥2b, kneser graph ka: B is defined in the following way:
Its vertex is a subset composed of B elements selected from the set of a given element. The two vertices have edges only when the two vertices are not intersection.

Chapter 3 Minimum Spanning Tree
VII. Prim
VIII. Kruskal
The minimum (weight) Spanning Tree algorithms will be elaborated in detail in this blog.

Chapter 4. Graph Matching
9. Hungary Algorithm
The Hungary algorithm is one of the many algorithms used to solve the linear task allocation problem. It is a classic algorithm used to solve the maximum matching problem of a bipartite graph and can solve the problem within the polynomial time, jack Edmonds, a Hungarian mathematician, proposed it in 1965.
This algorithm is unfamiliar. Next, I will explain it a little bit:

I. Description of Algorithm Application Problems in Hungary:
Set G = (V, E) to an undirected graph. For example, vertex set V can be partitioned into two non-overlapping subsets V1 and V2, and the two vertices attached to each edge in the graph belong to these two different subsets. The graph G is a binary graph. A bipartite graph can also be recorded as G = (V1, V2, e ).

Given a bipartite graph G, In a subgraph m of G, any two edges in the edge set {e} of m are not attached to the same vertex. M is a matching. Selecting the largest subset of the number of edge in such a subset is called the maximal matching problem)

If in a match, each vertex in the graph is associated with an edge in the graph, it is called a full match, also known as a complete, perfect match.

Ii. Algorithm Description
An obvious Algorithm for Finding the maximum match is: first find all the matches, and then keep the most matching number. However, the time complexity of this algorithm is an exponential function of the number of edges. Therefore, we need to find a more efficient algorithm.

The following describes the method for finding the maximum matching by using the augmented radio path (called the Hungarian algorithm, which was proposed by the Hungarian mathematician Edmonds in 1965 ).
Definition of zengguang Road (also known as augmented rail or staggered rail ):
If P is a path connecting two unmatched vertices in graph G, and its edge belongs to m and does not belong to M (that is, the edge that has been matched and to be matched) if P appears alternately, P is an augmented path relative to M.

The following three conclusions can be drawn from the definition of zengguang Road:
The path length of 1-P must be an odd number. The first and last edges do not belong to M.
2-perform an XOR operation on m and P to get a larger matching M '.
3-m is the maximum matching of G if and only if the augmented path of M does not exist.

Algorithm contour:
(1) Set M to null
(2) Find an augmented path P and use an exclusive or operation to obtain a larger matching m' instead of M.
(3) Repeat (2) the operation until the augmented path is not found.

Iii. time complexity and space complexity
Time Complexity
Adjacent matrix: The worst is O (n ^ 3) adjacent table: O (Mn)
Spatial complexity:
Adjacent matrix: O (N ^ 2) adjacent table: O (m + n)

Appendix:
Edmonds's matching

Chapter 5 strongly connected branch algorithms and network streams
10. Ford-Fulkerson
Ford-Fulkerson Algorithm ),
It is also called the Bellman-Ford algorithm and is used as a distance vector routing protocol, such as rip, BGP, iso idrp, and Novell IPX.

Appendix:Edmonds-Karp, dinic, push-relabel, maximum flow

Strongly Connected branch algorithm:
Kosaraju, gabow, and Tarjan.
This algorithm will be elaborated in the future.
.

July is copyrighted in any articles, content, and materials on this blog.
You must indicate the author and the source, and notify me of the reprinting. July and July February 14, 2011.

10 classic algorithms in the graphic algorithm Field

Author: July February 14, 2011.
Refer:
Wikipedia and 10 articles in the classic algorithm research series of this blog.

Bloggers:
1. This article includes all 20 important algorithms in the graphic algorithm field, and selects the top 10 algorithms.
2. The selection of the top ten algorithms is based on my personal opinion. The selection of other algorithms is not included in 10, but they are all mentioned in this article.
-------------------------------------------

Chapter 1: Basic Traversal
I. Deep Priority Search
2. breadth-first search
The two most basic algorithms in this graph traversal, BFS and DFS, are listed as the top 10 algorithms in this graph.
Because these two search algorithms are widely used and important.

For more information about the BFS and DFS algorithms, see:
Classical Algorithm Research Series: 4. How to thoroughly understand BFS and DFS Priority Search Algorithms
Http://blog.csdn.net/v_JULY_v/archive/2011/01/01/6111353.aspx

III. A * Search Algorithm
Both DFS and BFS are blind searches when expanding sub-nodes, that is,
It does not select which node is better in the next search and jumps to the node for the next search.
When you are not lucky, you need to test the complete solution set space. Obviously, it can only be applied to search problems with a small scale.

A * algorithm, as an important heuristic algorithm, is widely used in Optimal Path solving and policy design.
The most important part of a * algorithm lies in the design of a valuation function:
F (n) = g (n) + H (N)
F (n) is the valuation of every possible test point. It consists of two parts:
In part, g (n) indicates the cost from the start point to the current point (usually expressed by the depth of a node in the Search Tree ).
H (n) indicates the most important part in Heuristic Search, that is, the valuation of the current node to the target node.

For more information, see:
Classic Algorithm Research Series: 1. A * Search Algorithm
Http://blog.csdn.net/v_JULY_v/archive/2010/12/23/6093380.aspx

Appendix:
Flood fill
Leemars, wtzyb4446:
In Graphics, flood fill is filled with water and is used to fill areas.
It is like in a place until the water is fully stretched around until the ground stops.

Flood fill searches for the same point fill from one point to the surrounding until there are different points.
The flood fill we use is similar to this principle, which is a form of BFS.

Assume that one of the first drops of red ink in (I, j), and then the water begins to scatter and dye the upper and lower sides of it, that is (I-1, J), (I + 1, j), (I, J-1), (I, j + 1) these four points. then dye the surrounding area from these four points respectively... until it reaches a certain boundary.

The thought of converting this into BFS is that the initial element in the queue is (I, j), then the (I, j) extended state to get (I-1, J ), (I + 1, J), (I, J-1), (I, j + 1) these four states, join the queue. columns (I, j) and expands the next node... so

Chapter 2 shortest path algorithm
Iv. Dijkstra
Dijkstra algorithm, also known as Dijkstra ),
The algorithm solves the shortest path from a single source point to another vertex in the directed graph.

This Dijkstra algorithm has been described in two articles in this blog. For details, see:
I. Research Series of classical algorithms: II. Research on DIJKSTRA Algorithms
Http://blog.csdn.net/v_JULY_v/archive/2010/12/24/6096981.aspx
Ii. Classical Algorithm Research Series: Part 2: A thorough understanding of Dijkstra Algorithm
Http://blog.csdn.net/v_JULY_v/archive/2011/02/13/6182419.aspx

V. Bellman-Ford
Bellman-Ford:
To find the shortest path of a single source, you can determine whether there is a negative weight loop (If yes, there is no Shortest Path ),
Good timeliness, time complexity O (VE ).

Appendix:
Spfa:
It is the queue Optimization of Bellman-Ford, with relatively good timeliness and time complexity O (KE ). (K <v ).

6. Floyd-warshall
Floyd-warshall: Find the shortest path of multiple sources without negative weight edges. Use a matrix to record graphs. Poor timeliness, time complexity O (V ^ 3 ). This algorithm solves the shortest path between any two points. It can correctly handle the shortest path problem of directed graph or negative weight.

For more information, see:
Comparison of several Shortest Path Algorithms:
Http://blog.csdn.net/v_JULY_v/archive/2011/02/12/6181485.aspx

Appendix:Kneser Graph
A kneser graph is an algorithm related to the graph's fractional dyeing.
Given positive integers A, B, A ≥2b, kneser graph ka: B is defined in the following way:
Its vertex is a subset composed of B elements selected from the set of a given element. The two vertices have edges only when the two vertices are not intersection.

Chapter 3 Minimum Spanning Tree
VII. Prim
VIII. Kruskal
The minimum (weight) Spanning Tree algorithms will be elaborated in detail in this blog.

Chapter 4. Graph Matching
9. Hungary Algorithm
The Hungary algorithm is one of the many algorithms used to solve the linear task allocation problem. It is a classic algorithm used to solve the maximum matching problem of a bipartite graph and can solve the problem within the polynomial time, jack Edmonds, a Hungarian mathematician, proposed it in 1965.
This algorithm is unfamiliar. Next, I will explain it a little bit:

I. Description of Algorithm Application Problems in Hungary:
Set G = (V, E) to an undirected graph. For example, vertex set V can be partitioned into two non-overlapping subsets V1 and V2, and the two vertices attached to each edge in the graph belong to these two different subsets. The graph G is a binary graph. A bipartite graph can also be recorded as G = (V1, V2, e ).

Given a bipartite graph G, In a subgraph m of G, any two edges in the edge set {e} of m are not attached to the same vertex. M is a matching. Selecting the largest subset of the number of edge in such a subset is called the maximal matching problem)

If in a match, each vertex in the graph is associated with an edge in the graph, it is called a full match, also known as a complete, perfect match.

Ii. Algorithm Description
An obvious Algorithm for Finding the maximum match is: first find all the matches, and then keep the most matching number. However, the time complexity of this algorithm is an exponential function of the number of edges. Therefore, we need to find a more efficient algorithm.

The following describes the method for finding the maximum matching by using the augmented radio path (called the Hungarian algorithm, which was proposed by the Hungarian mathematician Edmonds in 1965 ).
Definition of zengguang Road (also known as augmented rail or staggered rail ):
If P is a path connecting two unmatched vertices in graph G, and its edge belongs to m and does not belong to M (that is, the edge that has been matched and to be matched) if P appears alternately, P is an augmented path relative to M.

The following three conclusions can be drawn from the definition of zengguang Road:
The path length of 1-P must be an odd number. The first and last edges do not belong to M.
2-perform an XOR operation on m and P to get a larger matching M '.
3-m is the maximum matching of G if and only if the augmented path of M does not exist.

Algorithm contour:
(1) Set M to null
(2) Find an augmented path P and use an exclusive or operation to obtain a larger matching m' instead of M.
(3) Repeat (2) the operation until the augmented path is not found.

Iii. time complexity and space complexity
Time Complexity
Adjacent matrix: The worst is O (n ^ 3) adjacent table: O (Mn)
Spatial complexity:
Adjacent matrix: O (N ^ 2) adjacent table: O (m + n)

Appendix:
Edmonds's matching

Chapter 5 strongly connected branch algorithms and network streams
10. Ford-Fulkerson
Ford-Fulkerson Algorithm ),
It is also called the Bellman-Ford algorithm and is used as a distance vector routing protocol, such as rip, BGP, iso idrp, and Novell IPX.

Appendix:Edmonds-Karp, dinic, push-relabel, maximum flow

Strongly Connected branch algorithm:
Kosaraju, gabow, and Tarjan.
This algorithm will be elaborated in the future.
.

July is copyrighted in any articles, content, and materials on this blog.
You must indicate the author and the source, and notify me of the reprinting. July and July February 14, 2011.

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.