当前位置:网站首页>Introduction to topological sorting
Introduction to topological sorting
2022-07-01 13:16:00 【Cherish forever】
In graph theory , Topological sorting is a linear sequence of all vertices of a directed acyclic graph . And the sequence must satisfy the following two conditions :
Every vertex appears and only once .
If there is one from the top A To the top B The path of , So the vertices in the sequence A Appear at the top B In front of .
If it doesn't exist in the end, the penetration is 0 The node of , That means there are rings , non-existent
Concepts in topology :
Partial order : There is no loop between two vertices in a directed graph , As for connectivity , It doesn't matter .
Total order : On the basis of partial order , Any pair of vertices in a directed acyclic graph also need to have a clear relationship ( Reflected in the figure , It's a one-way connected relationship , Be careful not to connect in two directions , Then it becomes a ring ).
A simple algorithm for topological sorting : First of all, we need to find any depth of 0 A vertex of , Delete it and all adjacent edges , The finding degree is 0 The summit of , And so on , Until all vertices are deleted . The deletion order of vertices is topological sorting .
void dfs( ){
for( Adjacency point K){
if(K Not visited ){
Mark K;
DFS(K);
}
}
}
边栏推荐
- CV顶会最佳论文得主分享:好论文是怎么炼成的?
- Google Earth engine (GEE) - Global Human Settlements grid data 1975-1990-2000-2014 (p2016)
- R language uses conf of yardstick package_ The mat function calculates the confusion matrix of the multiclass model on each fold of each cross validation (or resampling), and uses the summary to outpu
- 学历、长相、家境普通的人,未来的发展方向是什么?00后的职业规划都已经整得明明白白......
- Report on the "14th five year plan" and investment strategy recommendations for China's industrial robot industry 2022 ~ 2028
- Investment analysis and prospect prediction report of global and Chinese p-nitrotoluene industry Ⓙ 2022 ~ 2027
- Meta再放大招!VR新模型登CVPR Oral:像人一样「读」懂语音
- 终端识别技术和管理技术
- Flow management technology
- Meta enlarge again! VR new model posted on CVPR oral: read and understand voice like a human
猜你喜欢

Content Audit Technology

Redis exploration: cache breakdown, cache avalanche, cache penetration

Project deployment is not difficult at all!

What is the future development direction of people with ordinary education, appearance and family background? The career planning after 00 has been made clear

Meta再放大招!VR新模型登CVPR Oral:像人一样「读」懂语音

Huawei HMS core joins hands with hypergraph to inject new momentum into 3D GIS

VM虚拟机配置动态ip和静态ip访问

Google Earth engine (GEE) - Global Human Settlements grid data 1975-1990-2000-2014 (p2016)

A Fletter version of Notepad

Function test process in software testing
随机推荐
机器学习—性能度量
Localtime can't re-enter. It's a pit
Global and Chinese n-butanol acetic acid market development trend and prospect forecast report Ⓧ 2022 ~ 2028
Analysis report on the development pattern of China's smart emergency industry and the 14th five year plan Ⓠ 2022 ~ 2028
How can genetic testing help patients fight disease?
Google Earth Engine(GEE)——全球人类居住区网格数据 1975-1990-2000-2014 (P2016)
Look at the sky at dawn and the clouds at dusk, and enjoy the beautiful pictures
香港科技大学李泽湘教授:我错了,为什么工程意识比上最好的大学都重要?
Social distance (cow infection)
JS变色的乐高积木
Tencent always takes epoll, which is annoying
Terminal identification technology and management technology
北斗通信模块 北斗gps模块 北斗通信终端DTU
Development trend and market demand analysis report of China's high purity copper industry Ⓕ 2022 ~ 2028
Shangtang technology crash: a script written at the time of IPO
Meta再放大招!VR新模型登CVPR Oral:像人一样「读」懂语音
Class initialization and instantiation
Has anyone ever encountered this situation? When Oracle logminer is synchronized, the value of CLOB field is lost
华为HMS Core携手超图为三维GIS注入新动能
Content Audit Technology