POJ 1515 浅谈无向图边双连通分量Tarjan求法

这篇博客介绍了如何使用Tarjan算法解决无向图的边双连通分量问题,重点在于确定边的方向以使图变为强连通。文章通过实例解释了桥和割点的概念,并提供了算法转换无向边为有向边,确保图的强连通性。同时,博主分享了避免重复反向染色的特判技巧。
摘要由CSDN通过智能技术生成

这里写图片描述
世界真的很大
今天考试本来是水题欢乐AK赛,但是失败了
以为是写挂了其实是死路就错了。。
下午准备了一下课件,然后晚上继续复习图论
tarjan这一块儿强连通还是比较熟悉,但是两种双连通就不是很熟了
复习一波“桥”和“割点”的求法
向NOIP2017加油!

看题先:

description:

给你一个N个点和M条边的无向图,让你确定边的方向将图变成强连通。若无法确定某条边的方向使图变成强连通可以正反向输出这条边 以代表两条 有向边。

input:

The input consists of a number of cases. The first line of each case contains two integers n and m. The number of intersections is n (2 <= n <= 1000), and the number of streets is m. The next m lines contain the intersections incident to each of the m streets. The intersections are numbered from 1 to n, and each street is listed once. If the pair i j is present, j i will not be present. End of input is indicated by n = m = 0.

output:

For each case, print the case number (starting from 1) followed by a blank line. Next, print on separate lines each street as the pair i j to indicate that the street has been assigned t

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值