当前位置:网站首页>[learning notes] shortest path + spanning tree
[learning notes] shortest path + spanning tree
2022-06-28 08:14:00 【Ants looking up at the stars】
Difficult subject
Opening Portals
Good question !
We call the portal the key point .
Let the distance between any two keys be dist(i,j) , Considering the nature of the transmission , All you need is a spanning tree that connects all the key points , And then traverse from any key point , Exactly the sum of the edge weights of the spanning tree .( It's a little twisted )
If we start at each key point dijkstra , The time complexity is O ( n 2 log n ) O(n^2\log n) O(n2logn) .
For this model , We have a Multi source shortest path Algorithm :
- Start with each key , Find the shortest distance to each point
- Consider enumerating an edge (u,v,w) , Connect the two keys closest to the two endpoints of this edge :( It is equivalent to enumerating transit points )
The correctness is obvious .
Specially ,MST That is, every point is a key point .
Of course , An edge may be computed multiple times on the spanning tree .
Complete the MST
This problem does not require a sophisticated algorithm . Direct recklessness
You can run the complete graph directly MST , Then find a small spanning tree ( Just discuss it separately ) .
Jumping Around
boruvka Board questions
Trial for Chief
What a delicate little structure !
I never thought it was the shortest circuit !
Consider from (i,j) set out , The distance between adjacent grids with different colors is 1 , The distance between grids with the same color is 0 , Find the farthest black grid , The answer for dist+1 .( Special judgment: all white )
Consider its meaning . Equivalent to alternating black and white , Operate greedily .
Flights
Cuckoo ...
Difference constraint + shortest path !!
Capitalism
Wonderful topic !
First, it is judged that the odd ring must have no solution .
The picture of this problem is very special , Because it's a two-way side , Therefore, starting from any point of the connected block, you can reach other points . So let's enumerate S As a starting point , Run differential constraint .
What happens is that there will be no edge connected dis[u]=dis[v] The situation of , Otherwise, odd rings will appear .
In this way, we can get the solution of a combination method .
Then, the maximum range must be satisfied .
Cannot build super origin .qwq
边栏推荐
- asp. Net registration page
- ROS notes (09) - query and setting of parameters
- [shangpinhui] project notes
- Discussion on the application of GIS 3D system in mining industry
- 新唐NUC980使用记录:自制开发板(基于NUC980DK61YC)
- 关于在cmd中MySQL不能插中文数据的原因
- Redis master-slave structure and application scenarios
- 【学习笔记】线性基
- Host is not allowed to connect to this MySQL server
- Trigonometric transformation formula
猜你喜欢
Redis master-slave structure and application scenarios
Unity gets the coordinate point in front of the current object at a certain angle and distance
Chenglian premium products donated love materials for flood fighting and disaster relief to Yingde
The preliminary round of the sixth season of 2022 perfect children's model Foshan competition area came to a successful conclusion
Jenkins' common build trigger and hook services (V)
Devops foundation chapter Jenkins deployment (II)
B_ QuRT_ User_ Guide(27)
ROS notes (09) - query and setting of parameters
【学习笔记】拟阵
2022第六季完美童模 佛山赛区 初赛圆满落幕
随机推荐
NLP sequence can completely simulate human brain intelligence
How to choose an account opening broker? Is it safe to open an account online?
开户券商怎么选择?网上开户是否安全么?
22/02/14 study notes
Configuring multiple instances of MySQL under Linux
The preliminary round of the sixth season of 2022 perfect children's model Foshan competition area came to a successful conclusion
B_ QuRT_ User_ Guide(27)
Connaissez - vous le protocole TCP (2)?
asp. Net error "/" server error in the application. String or binary data would be truncated. The statement...
How to insert a single quotation mark into a table as a data type in Oracle pl/sql
Study notes 22/1/19 and 22/1/20
Host is not allowed to connect to this MySQL server
Introduction to Devops Basics
Oracle RAC -- understanding of VIP
券商注册开户靠谱吗?安全吗?
ROS notes (09) - query and setting of parameters
MySQL installation and environment variable configuration
MySQL two table connection principle (understand join buf)
Prometheus service discovery
设置网页的标题部分的图标