Dijkstra algorithm details (single source shortest path algorithm)

Most of us may know BFS and DFS better. For Dijkstra algorithm, it is the algorithm to solve the single source shortest path problem in the graph algorithm structure. It is probably such a weighted graph. Dijkstra algorithm can calculate the shortest path from any node to other nodes. (single source shortest path problem), Dijkstra algorithm c ...

Posted by hayson1991 on Sun, 05 Dec 2021 12:37:44 -0800

Network flow and bipartite graph

0. Change log 2021.12.5: replace template code. Add a bipartite chart. 1. Network flow The key of network flow is modeling. Modeling is the essence and modeling is human wisdom. 1.1. Maximum network flow Maximum Flow, MF for short. A directed graph network \ (G=(V,E) \), gives the source and sink \ (S,T \), and each edge \ ((u,v) \) has capacit ...

Posted by defect on Sun, 05 Dec 2021 10:46:03 -0800

PAT class a 1119 pre - and post order Traversals

PAT class a 1119 pre - and post order Traversals Suppose that all the keys in a binary tree are distinct positive integers. A unique binary tree can be determined by a given pair of postorder and inorder traversal sequences, or preorder and inorder traversal sequences. However, if only the postorder and preorder traversal sequences are given, ...

Posted by highjo on Sat, 04 Dec 2021 16:05:14 -0800

P1352 SSL 1607 party without boss (chain forward star)

Title Description: Title portal Problem solving ideas: According to the meaning of the question, this question is to select several points on a tree to maximize the point weight, in which the selected points meet two conditions: If the parent node is selected, the child node cannot be selectedIf a child node is selected, the parent node c ...

Posted by kir10s on Fri, 03 Dec 2021 18:38:00 -0800

Graph theory learning notes - linked list and adjacency list

Linked list 1. Preface C/C + + has its own data structure - array, which is easy to use, but it can't insert or delete elements at any position, so we need another data structure to realize this operation, so the linked list was born. The linked list supports insertion or deletion at any position, but can only access the elements in order. We ...

Posted by messels on Fri, 03 Dec 2021 15:17:21 -0800

Greedy algorithm for single source shortest path (dijestra algorithm)

catalogue 1. Description of single source shortest path problem 2.Dijkstra algorithm idea 3. Specific case analysis 4. Specific code implementation   1. Description of single source shortest path problem ① Given weighted digraph G =(V,E). Where V is the set of all vertices in the graph. E is the set of all edges in the graph, and the ...

Posted by caster001 on Tue, 30 Nov 2021 22:49:01 -0800

All source shortest path

All source shortest path P5905 [template] Johnson's all source shortest path - New Ecology of computer science education in Luogu (luogu.com.cn) Like Floyd, Johnson is an algorithm that can find the shortest path between any two points on a nonnegative ring graph. 1. Algorithm overview The shortest path between any two points can be solved by e ...

Posted by syamswaroop on Tue, 30 Nov 2021 20:58:43 -0800

Machine design (mountain climbing)

Title Description: let a machine be controlled by n It consists of two parts, and each part can be m From different suppliers. supplier j Supplied parts i With weight Wij And price Cij . Design an algorithm to solve the total price does not exceed the upper limit c The minimum weight of the machine. (design a branch a ...

Posted by ptolomea on Sun, 28 Nov 2021 13:15:28 -0800

Prim algorithm solves the minimum spanning tree (solves the road repair problem)

1, What is Prim algorithm         The process of finding the minimum spanning tree by prim algorithm adopts the idea of greedy algorithm. For a connected network with N vertices, PRIM algorithm finds an edge with the smallest weight from the connected network every time. This operation is repeated N-1 times. The spanning tr ...

Posted by Hafkas on Mon, 22 Nov 2021 15:48:24 -0800

Basic algorithm set of graph (Java) (shortest path and minimum spanning tree)

Basic algorithm set of graph (shortest path and minimum spanning tree) 1. Shortest path algorithm (DFS Freud dijestra Bellman Ford) 1.1DFS two-point shortest path In fact, not only depth first search, but also breadth first search can solve such problems. DFS is introduced here. DFS and BFS are not much different in solving the problem of th ...

Posted by scrupul0us on Sun, 21 Nov 2021 16:21:24 -0800