Semiconnected--强连通缩点

这篇博客介绍了如何判断一个有向图是否为半连通图。半连通图定义为对于所有节点对,至少有一个节点可以到达另一个节点。文章提供了样例输入和输出,并提出了解决思路:如果入度为0的节点超过一个,则图不是半连通的;通过对图进行缩点,如果缩点后的图形成一条直线,且入度和出度为0的节点各只有一个,那么原图是半连通的。
摘要由CSDN通过智能技术生成

1451: Semiconnected

时间限制: 1 Sec   内存限制: 32 MB
提交: 79   解决: 20

题目描述

For a directed graph G = (V, E), if for all pairs of nodes u,v, u can always reach v or v can always reach u , then we call this a Semiconnected graph. Now you are given a directed graph, you should tell us whether it is a Semiconnected graph. If it is, output “yes”, or else“no”.

输入

There are several test cases, for each test case, there are two integers in the first line, n and

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值