Questions tagged [connected-components]

50 questions
7
votes
0 answers

When would Kosaraju's algorithm be a better choice than Tarjan's for strongly connected components?

I know both have runtime complexity $\mathcal{O} (V+E)$, but Tarjan's algorithm does a single DFS pass, whereas Kosaraju's does two DFS passes. Both need extra space (e.g. a dynamic set, often a stack, for the former to keep track of low links, and…
5
votes
1 answer

Computing a pre-topological sort using a BFS/a queue

Computing a topological sort in a DAG using a queue simply amounts to putting the nodes with indegree 0 in a queue, and going through the queue removing these nodes from the graph and adding the nodes that are newly with indegree 0. This of course…
5
votes
1 answer

Add edges to undirected graph to make connected and minimize longest path

I am trying to find an efficient algorithm to solve to following problem: Given an undirected disconnected graph, I want to add as few as possible edges to make to graph connected while minimizing the number of vertices on the longest path in the…
4
votes
1 answer

The number of connected components in the context of cyclomatic complexity

Cyclomatic Complexity is defined with reference to the control flow graph of the program through this formula (borrowed from Wikipedia): M = E − N + 2P, where E = the number of edges of the graph. N = the number of nodes of the graph. P = the number…
Ilya Loskutov
  • 217
  • 2
  • 8
3
votes
0 answers

reference for SAT formula for connectedness

SAT formulas for connectedness of a set of nodes in a graph can be constructed, basically by specifying the distance of each node to a source node, see for example the answers here: Boolean constraints for a connected component of a graph and SAT…
Hendrik Jan
  • 31,459
  • 1
  • 54
  • 109
3
votes
1 answer

Efficiently determine which nodes should leave a graph while maintaining connectedness

Suppose I have a graph with node weights, where a weight is either -1 or a positive integer. For example: If a node has weight -1, it is "happy", and cannot be kicked out of the graph. If a node has positive weight, it is "unhappy", and can be…
3
votes
2 answers

Efficiently check if removing an edge splits a strongly connected component

I have a strongly connected component (SCC) of $n$ vertices. Let $n_1n_2$ be an edge between two vertices $n_1$ and $n_2$ in this SCC. Is there an efficient algorithm to check if removing the edge $n_1n_2$ splits the SCC into two SCCs or not? The…
thambi
  • 125
  • 9
3
votes
1 answer

Fast algorithm for finding the size of each connected component in a graph of 2D points

I've been thinking about this for a while now. Given a graph $G$ of 2-dimensional points (we draw the edges based on a "threshold" distance), find $s_1, s_2, \dots, s_k$, the sizes of all connected components in $G$. The vertices of the graph are…
3
votes
0 answers

Components of subset partial order

Given a collection C of sets, there are a number of proposed algorithms for building the subset partial order, e.g. this paper. But is there any work on algorithms that return the [components of such collection, that is the weakly connected…
3
votes
1 answer

Equivalence of states between two "quasi-deterministic" strongly connected Büchi automata accepting the same $\omega$-language

Hope someone can point me to the right direction to solve this problem. Premise. I call quasi-deterministic Büchi automaton (qDBA) a Büchi automaton $B = \langle S, \Sigma, S_0, \delta, F \rangle$, where $S$ is the set of states, $\Sigma$ the…
3
votes
2 answers

Articulation points (or cut vertices), but only subset of vertices need to be connected

I know we can find all articulation points efficiently in a graph using DFS. But what if not all nodes need to be connected, but instead we have set of node pairs that need to communicate (there is a path between them). How to efficiently find all…
3
votes
0 answers

Maintaining SCCs in directed graphs (on-line, under edge deletion) with ES-trees

I'm interested in efficiently maintaining the set of strongly connected components (SCC) in a directed (unweighted) graph under edge deletions only. While searching for ways I came across an article [1] that uses a generalised version of…
2
votes
1 answer

Tseitin formula on 2-connected graph

How can we prove that for $\\\\$ every $\\\\$ 2-connected graph G with an odd number of vertices, the unsatisfiable Tseitin formula for it is minimally unsatisfiable, that is, if we remove even a single clause, it becomes satisfiable?
user167124
2
votes
0 answers

Borůvka's step in linear time

I am trying to understand this Expected linear time MST algorithm, and I have a problem in the implementation of the Borůvka's step. My problem is with the removal of duplicate edges between merged connected components and keep the one with minimal…
2
votes
1 answer

Boolean constraints for a connected component of a graph

Suppose I have an undirected graph $G=(V,E)$, and boolean variables $x_v$ (one for each vertex $v \in V$). These variables select a subset $S \subseteq V$ of vertices, namely the vertices $S=\{v \mid x_v\}$ whose corresponding boolean variable is…
D.W.
  • 167,959
  • 22
  • 232
  • 500
1
2 3 4