当前位置:网站首页>[learning notes] connectivity and circuit of graph
[learning notes] connectivity and circuit of graph
2022-07-05 14:18:00 【Ants looking up at the starry sky】
Graph Subset Problem
The first step is to delete something wonderful .
If the degree of a point < K-1 Then obviously it will not contribute to the answer , It can be deleted by a process similar to topological sorting .
If the degree <= K-1 There are some words left after deleting the dot of , Can solve case 1 .
The size of this question is K The regiment is not easy to find .
My initial practice withered
Consider deleting degrees = K-1 Judge whether this point is in a group .
direct O ( K 2 ) O(K^2) O(K2) Whether enumeration has two sides .
A little calculation will find the time complexity O ( m m log n ) O(m\sqrt{m}\log n) O(mmlogn) .
details : When a point is out of line, delete the point and its adjacent edges , Pay attention to one point. Don't join the team for many times .
Tanya and Password
Take it apart and you will find that this problem is asking you to ask Euler .
You can simulate with stack , After considering a point of immobility , Put this path in reverse order into the answer .
details : Pay attention to judge the connectivity of the graph , Because it is a directed graph, it is convenient to check the length of the final sequence .
We must judge the degree of nodes first
Data Center Drama
Can't
At first, I was wrong .
In fact, it's easy to think of Euler's circuit when you see the limit that the out and in degrees are even .
The problem is that the Euler loop guarantees the output = The degree of , There is no guarantee that the access is even .
Consider inverting even edges in Euler circuits , In this way, except for the end point, the points on the path must meet the limit .
Finally, determine the total number of edges , If it is an odd number, connect a self ring at the starting point .
边栏推荐
- SSH免密码登录详解
- 03_Solr之dataimport
- 鸿蒙第四次培训
- LeetCode_ 3 (longest substring without repeated characters)
- Use the word "new" to attract curious people
- The forked VM terminated without saying properly goodbye
- 微服务项目部署后,无法访问静态资源,无法访问到上传到upload中的文件,解决办法
- R语言使用ggplot2包的geom_histogram函数可视化直方图(histogram plot)
- Kunlun Taike rushes to the scientific innovation board: the annual revenue is 130million, and it plans to raise 500million. CETC Taiji holds 40% of the shares
- R语言ggplot2可视化:gganimate包基于transition_time函数创建动态散点图动画(gif)、使用shadow_mark函数为动画添加静态散点图作为动画背景
猜你喜欢
快消品行业SaaS多租户解决方案,构建全产业链数字化营销竞争力
How to protect user privacy without password authentication?
日化用品行业智能供应链协同系统解决方案:数智化SCM供应链,为企业转型“加速度”
What are the advantages and characteristics of SAS interface
让秒杀狂欢更从容:大促背后的数据库(下篇)
Redis如何实现多可用区?
TiFlash 源码解读(四) | TiFlash DDL 模块设计及实现分析
Principle and performance analysis of lepton lossless compression
基于 TiDB 场景式技术架构过程 - 理论篇
世界环境日 | 周大福用心服务推动减碳环保
随机推荐
Redis如何实现多可用区?
R Language ggplot2 Visualization: visualize linegraph, using Legend in Theme function. Paramètre de position emplacement de la légende personnalisée
强联通分量
广发期货排名多少?网上办理广发期货开户安全可靠吗?
How does redis implement multiple zones?
LeetCode_ 69 (square root of x)
How to deeply understand the design idea of "finite state machine"?
IP packet header analysis and static routing
Use the word "new" to attract curious people
04_ Use of solrj7.3 of solr7.3
The forked VM terminated without saying properly goodbye
Thymeleaf 使用后台自定义工具类处理文本
R language ggplot2 visualization: use ggplot2 to visualize the scatter diagram, and use the labs parameter to customize the X axis label text (customize X axis labels)
Sorter evolution of ticdc 6.0 principle
Simple process of penetration test
R语言ggplot2可视化密度图:按照分组可视化密度图、自定义配置geom_density函数中的alpha参数设置图像透明度(防止多条密度曲线互相遮挡)
分享 20 个稀奇古怪的 JS 表达式,看看你能答对多少
基于 TiDB 场景式技术架构过程 - 理论篇
[buuctf.reverse] 152-154
03_Solr之dataimport