当前位置:网站首页>Complete diagram / Euler loop
Complete diagram / Euler loop
2022-06-26 14:23:00 【Honestbutter-】
Complete graph : A complete graph is a simple undirected graph , Each edge has a different pair of vertices . Complete graphs have at most n*(n-1)/2 side
Find the minimum and maximum of the longest path :
minimum value : First, the longest path cannot have a ring , Otherwise it will be infinite , So in the acyclic case , Every point goes through once , The minimum value of the longest path is n − 1 n-1 n−1
Maximum : Go all the way —— Euler circuit , And because the Euler circuit of an undirected graph has at most ( n − 1 ) n / 2 (n-1)n/2 (n−1)n/2 side , The Euler loop requires that the points of odd degree of an undirected graph have at most 2 individual , Discussion on odd and even points
- Odd points : n n n It's odd , ( n − 1 ) (n-1) (n−1) For the even , therefore n n n An odd number of points. Each point has ( n − 1 ) (n-1) (n−1) Even edges , Conform to Euler circuit , The length is ( n − 1 ) n / 2 (n-1)n/2 (n−1)n/2
- Even points : even numbers n n n One point is ( n − 1 ) (n-1) (n−1) Odd edges , Because there are at most two odd sides , So there is ( n − 2 ) (n-2) (n−2) A dot needs to delete an edge , Because an undirected graph , So a total of ( n − 2 ) / 2 (n-2)/2 (n−2)/2 side , The length is ( n − 1 ) n / 2 − ( n − 2 ) / 2 (n-1)n/2-(n-2)/2 (n−1)n/2−(n−2)/2
#include<iostream>
using namespace std;
int main()
{
long long n;
cin>>n;
if(n&1) cout<<n-1<<" "<<(n-1)*n/2<<endl;
else cout<<n-1<<" "<<(n-1)*n/2-(n-2)/2<<endl;
return 0;
}
边栏推荐
猜你喜欢

程序员必备,一款让你提高工作效率N倍的神器uTools

C language | file operation and error prone points

windows版MySQL软件的安装与卸载

Freefilesync folder comparison and synchronization software

Win10 home vs pro vs enterprise vs enterprise LTSC

ArcGIS cannot be opened and displays' because afcore cannot be found ' DLL, solution to 'unable to execute code'

Codeforces Global Round 21A~D

9项规定6个严禁!教育部、应急管理部联合印发《校外培训机构消防安全管理九项规定》

服务器创建虚拟环境跑代码

Sword finger offer 05.58 Ⅱ string
随机推荐
SwiftUI找回丢失的列表视图(List)动画
Lucky numbers in the matrix
Installation and uninstallation of MySQL software for windows
程序员必备,一款让你提高工作效率N倍的神器uTools
Usage of unique function
ICML 2022 | LIMO: 一种快速生成靶向分子的新方法
Sword finger offer 21.57.58 I Double pointer (simple)
In insect classes and objects
同花顺股票开户选哪个证券公司是比较好,比较安全的
When drawing with origin, capital letter C will appear in the upper left corner of the chart. The removal method is as follows:
团队管理的最关键因素
Knowledge about adsorption
Server create virtual environment run code
Installation tutorial about origin2019
vmware部分设置
Eigen(3):error: ‘Eigen’ has not been declared
Record: why is there no lightning 4 interface graphics card docking station and mobile hard disk?
Codeforces Round #765 (Div. 2) D. Binary Spiders
MHA高可用配合及故障切换
Sword finger offer 45.61 Sort (simple)