当前位置:网站首页>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);
}
}
}
边栏推荐
- 学历、长相、家境普通的人,未来的发展方向是什么?00后的职业规划都已经整得明明白白......
- Meta再放大招!VR新模型登CVPR Oral:像人一样「读」懂语音
- Content Audit Technology
- Class initialization and instantiation
- 有没有大佬 遇到过flink监控postgresql数据库, 检查点无法使用的问题
- Report on the 14th five year plan and future development trend of China's integrated circuit packaging industry Ⓓ 2022 ~ 2028
- Professor Li Zexiang, Hong Kong University of science and technology: I'm wrong. Why is engineering consciousness more important than the best university?
- 【开发大杀器】之Idea
- Operator-1 first acquaintance with operator
- 不同的测试技术区分
猜你喜欢
VM virtual machine configuration dynamic IP and static IP access
Judea pearl, Turing prize winner: 19 causal inference papers worth reading recently
【开发大杀器】之Idea
Different test techniques
Hardware development notes (9): basic process of hardware development, making a USB to RS232 module (8): create asm1117-3.3v package library and associate principle graphic devices
Jenkins+webhooks- multi branch parametric construction-
软件测试中功能测试流程
逆向调试入门-PE结构-输入表输出表05/07
The future of game guild in decentralized games
华为HMS Core携手超图为三维GIS注入新动能
随机推荐
Social distance (cow infection)
Apache-Atlas-2.2.0 独立编译部署
Content Audit Technology
数字化转型再下一城,数字孪生厂商优锘科技宣布完成超3亿元融资
Global and Chinese polypropylene industry prospect analysis and market demand forecast report Ⓝ 2022 ~ 2027
Tencent always takes epoll, which is annoying
从数据库中更新一条数据,用cdc会同时获得op字段分别为d和c的两条数据吗?我记得之前是只有op为u
The 14th five year plan of China's environmental protection industry and the report on the long-term goals for 2035 Ⓖ 2022 ~ 2028
我花上万学带货:3天赚3元,成交靠刷单
[development of large e-commerce projects] performance pressure test - basic concept of pressure test & jmeter-38
商汤科技崩盘 :IPO时已写好的剧本
请问flink mysql cdc 全量读取mysql某个表数据,对原始的mysql数据库有影响吗
During Oracle CDC data transmission, the CLOB type field will lose its value during update. There is a value before update, but
Redis exploration: cache breakdown, cache avalanche, cache penetration
Investment analysis and prospect prediction report of global and Chinese dimethyl sulfoxide industry Ⓦ 2022 ~ 2028
有没有大佬 遇到过flink监控postgresql数据库, 检查点无法使用的问题
Application of 5g industrial gateway in scientific and technological overload control; off-site joint law enforcement for over limit, overweight and overspeed
Three questions about scientific entrepreneurship: timing, pain points and important decisions
Idea of [developing killer]
Use of shutter SQLite