当前位置:网站首页>[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
边栏推荐
- 微内核Zephyr获众多厂家支持!
- App automated testing appium Tutorial Part 1 - advanced supplementary content
- Ambari (VIII) --- ambari integrated impala document (valid for personal test)
- Is it reliable for the top ten securities companies to register and open accounts? Is it safe?
- 挖财注册开户靠谱吗?安全吗?
- SOC timer and interrupt configuration
- IO error in Oracle11g: got minus one from a read call
- 图像翻译:UVCGAN: UNET VISION TRANSFORMER CYCLE-CONSISTENT GAN FOR UNPAIRED IMAGE-TO-IMAGE TRANSLATION
- asp. Net error "/" server error in the application. String or binary data would be truncated. The statement...
- [JS] - [DFS, BFS application] - learning notes
猜你喜欢

2022第六季完美童模 佛山赛区 初赛圆满落幕

安装nrm后,使用nrm命令报错internal/validators.js:124 throw new ERR_INVALID_ARG_TYPE(name, ‘string‘, value)

Configuring MySQL multi instance master-slave synchronization for Linux

探讨gis三维系统在矿山行业中的应用

关于如何在placeholder中使用字体图标
![[JS] - [DFS, BFS application] - learning notes](/img/77/6f8d4ebe1d0b3ba036aea9358de793.png)
[JS] - [DFS, BFS application] - learning notes

新唐NUC980使用记录:自制开发板(基于NUC980DK61YC)

B_QuRT_User_Guide(26)

Prometheus service discovery

App automated testing appium Tutorial Part 1 - advanced supplementary content
随机推荐
Airflow2.1.1 ultra detailed installation document
Generation and verification of JWT token
SQL master-slave replication setup
Three step problem of leetcode
挖财注册开户靠谱吗?安全吗?
Airflow2.1.1 summary of the pits stepped on in actual combat!!
The micro kernel zephyr is supported by many manufacturers!
sql分析(查询截取分析做sql优化)
Host is not allowed to connect to this MySQL server
11grac turn off archive log
Is it reliable for the top ten securities companies to register and open accounts? Is it safe?
Doris学习笔记之介绍、编译安装与部署
Unity gets the coordinate point in front of the current object at a certain angle and distance
Study notes 22/1/19 and 22/1/20
22/02/15 study notes
Study notes 22/1/10
MySQL tablespace parsing
B_ QuRT_ User_ Guide(27)
Reverse mapping of anonymous pages
Installing MySQL under Linux