0

I'm struggling a bit here because quite honestly my brain is fried and I'm clueless as to what to do.

My task is to find connector's in a undirected, unweighted, graph.

The task claims that: In an undirected graph, vertex v is a connector if there are at least two other vertices x and w for which every path between x and w goes through v.

Don't get me wrong, I get what this means, but I'm hopelessly doing this. When I go through this graph (it is suggested I use DFS), what am I suppose to do exactly?

I just wanna be on the right path of finishing this.

Any help is much appreciated!

  • I think that to be a connector, a vertex must be a connector for its immediate neighbors, so: for every vertex v in the graph get all its neighbors. Use DFS to obtain all paths between each pair of neighbor n1, n2 . If all obtained paths go through v then v is a connector between n1, n2. – c0der Dec 05 '19 at 11:36

1 Answers1

1

The connector you are describing is the cut vertice (or articulation point): https://en.wikipedia.org/wiki/Biconnected_component)

To find all the articulation points in an undirected graph, we can use a modified DFS algorithm. The general idea is to run DFS on the graph while marking every node n with 2 variables: integer LOW(n) and integer dfs(n). If a node v’s neighbor w has LOW(w) >= dfs(v), node v is an articulation point.The pseudo-code is described as below:

Execute DFS(v)
When a vertex v is first discovered, LOW(v) = dfs(v) 
For each of v’s neighbors w
    if w is undiscovered 
        execute DFS(w)
        LOW(v) = min of {LOW(v), LOW(w)}
        if LOW(w) ≥ dfs(v), v is connector!!!!!Store it.
    else if w is v’s parent, do nothing
    else (w is not v’s parent but has already been discovered)
        LOW(v) = min of {LOW(v), dfs(w)}

This algorithm has the running time the same as a basic DFS algorithm: O(V+E), in which V is the number of vertices in the graph, and E is the number of edges in the graph.