Description
According to the Automobile Collision Monitor (ACM), most fatal traffic accidents occur on two-way streets. In order to reduce the number of fatalities caused by traffic accidents, the mayor wants to convert as many streets as possible into one-way streets. You have been hired to perform this conversion, so that from each intersection, it is possible for a motorist to drive to all the other intersections following some route.
You will be given a list of streets (all two-way) of the city. Each street connects two intersections, and does not go through an intersection. At most four streets meet at each intersection, and there is at most one street connecting any pair of intersections. It is possible for an intersection to be the end point of only one street. You may assume that it is possible for a motorist to drive from each destination to any other destination when every street is a two-way street.
Input
The input consists of
【POJ】 1515 无向连通图定向边改造为强连通
最新推荐文章于 2021-05-12 12:53:41 发布
该博客探讨了一种方法,通过定向无向边尽可能保持图的强连通性。首先,通过双连通组件找出图中的桥梁。接着,移除桥梁后,对每个连通分量进行深度优先搜索,定向搜索路径上的边,确保形成的子图是强连通的。最终输出定向边的结果。
摘要由CSDN通过智能技术生成