Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are strongly connected components used for?

I have found several algorithms that explain how to find strongly connected components in a directed graph, but none explain why you would want to do this. What are some applications of strongly connected components?

like image 649
fdh Avatar asked Jun 26 '12 17:06

fdh


People also ask

What is the use of strongly connected graph?

A directed graph is called strongly connected if there is a path in each direction between each pair of vertices of the graph. That is, a path exists from the first vertex in the pair to the second, and another path exists from the second vertex to the first.

What is the difference between connected components and strongly connected components?

connected: you can get to every vertex from every other vertex. strongly connected: every vertex has an edge connecting it to every other vertex.

What is kosaraju's algorithm used for?

Kosaraju's algorithm is used to find the Strongly Connected Components in a graph in linear time.

What is strongly connected graph give example?

A directed graph is strongly connected if there is a path between any two pair of vertices. For example, following is a strongly connected graph. It is easy for undirected graph, we can just do a BFS and DFS starting from any vertex. If BFS or DFS visits all vertices, then the given undirected graph is connected.


3 Answers

You should check out Tim Roughgarden's Introduction to Algorithms course on Coursera. For every algorithm he goes over, he explains some applications of it. Very useful, and makes one see the value of studying algorithms!

The use of strongly connected components that I remember him saying is that one could use it to find groups of people who are more closely related in a huge set of data. Think of facebook and how they recommend people that might be your friends...

This could also be used to see chunks of a population. Say, "Wow, this huge component all has the hobby of walking backwards and likes eating moldy pizza!," it could show correlation. Advertisers for moldy pizza would use this data to target people who like walking backwards. Who knows!

like image 163
twmb Avatar answered Oct 17 '22 22:10

twmb


One example is in model checking:

Finding strongly connected component is done in explicit model checking in formal verification.

In model checking - we have a state machine, which represents the models of our software/hardware, and we try to prove temporal logic1 formulas on it.

For example: The formula EG(p) means: there is a path in the graph, where for each state - the logic formula p yields true.

The algorithm for proving if EG(p) is true on a graph (model) is finding the maximal strongly connected components (SCC), and then checking paths leading to it in the graph.

Note that model checking is applied widely in the industry - especially for proving correctness of hardware components.


(1) The importance of temporal logic to computer science is great, and its inventor Amir Pnueli recieved a turing award for it!

like image 28
amit Avatar answered Oct 17 '22 23:10

amit


Another application can be found in vehicle routing applications. A road network can be modeled as a directed graph, with vertices being intersections, and arcs being directed road segments or individual lanes. If the graph isn't Strongly Connected, then vehicles can get trapped in a certain part of the graph (i.e they can get in, but not get out).

In many of these vehicle routing applications, you want to generate routes for a specific area (for instance a routing problem within a city). Prior to generate routes, you would have to extract street data, for instance from Google Maps, Here maps, or Open Street maps. These maps do not just cover the area you are interested in, but they cover the entire world. Consequently you end up taking a snapshot of the area of interest, for instance by computing the induced subgraph of all intersections who's geographical coordinates lay within the area of interest. The resulting subgraph is not necessarily strongly connected (for instance, you can have a road that enters and leaves the area, but is not connected to any other road inside the area). One would then preprocess the subgraph by enumerating all strongly connected components, and throwing away all but the largest component.

like image 24
Joris Kinable Avatar answered Oct 18 '22 00:10

Joris Kinable