# Semi-streaming algorithm for $s$-$t$ connectivity

Computer Science Asked by KaliTheGreat on November 30, 2020

Let $$G=(V,E)$$ be an undirected graph. Given a pair of vertices $$s,t in V$$, how can we construct a semi-streaming algorithm which determines is $$s$$ and $$t$$ are connected? Is there any way to construct such an algorithm which scans the input stream only once?

Note that a semi-streaming algorithm is presented an arbitrary order of the edges of $$G$$ as a stream, and the algorithm can only access this input sequentially in the order it is given; it might process the input stream several times. The algorithm has a working memory consisting of $$O(nlog^{O(1)}n)$$ bits.

You cannot do it in a single pass. Consider the set of all graphs of the following form: the vertices are $${s,t} cup A cup B$$, where $$|A|=|B|=n/2-1$$. The only allowed edges are between $$s$$ and $$A$$, between $$A$$ and $$B$$, and between $$B$$ and $$t$$.

Suppose that the algorithm is first presented with the $$(A,B)$$ edges, and then with the $$(s,A),(B,t)$$ edges. After reading the $$(A,B)$$ edges, it must "remember" all of them, since there could be only one $$(s,A)$$ edge and only one $$(B,t)$$ edge, in which case the answer depends on whether the corresponding vertices in $$A$$ and $$B$$ are connected. Since there are $$2^{(n/2-1)^2}$$ choices for the $$(A,B)$$ edges, the algorithm must have a memory of at least $$(n/2-1)^2$$ bits (since after reading the $$(A,B)$$ edges, it could be in any of $$2^{(n/2-1)^2}$$ possible states).

Answered by Yuval Filmus on November 30, 2020

## Related Questions

### Solving the Knapsack problem in $O(n^2P)$, where P is the maximum weight of all items

1  Asked on November 28, 2021 by user2207686

### Number of words of length n for special language

0  Asked on November 28, 2021

### Intuition for Church-Turing thesis for Turing machines

2  Asked on November 28, 2021

### Global-input-local-output p-time algorithms

0  Asked on November 25, 2021

### Does a regular expression exist for any number that contains no more than two 5s and no 6 twice in a row?

2  Asked on November 25, 2021 by hish

### Is $EVEN-SAT$ $NP$-hard?

2  Asked on November 23, 2021 by zur-luria

### Proof of the undecidability of compiler code optimization

5  Asked on November 23, 2021 by stephen-mwangi

### Counting circuits with constraints

1  Asked on November 23, 2021 by judy-l

### Uncurrying and Polymorphism

3  Asked on November 21, 2021

### Algorithm suggestion to order data with specific condition

0  Asked on November 21, 2021 by user3862410

### If $A$ is context-free then $A^*$ is regular

1  Asked on November 21, 2021

### Which is the best approach to solve Turing machines exercises?

2  Asked on November 17, 2021 by ocram

### What is the reason for writing parallel programs?

1  Asked on November 17, 2021 by user123521

### Are all Recursively Enumerable languages which are not Recursive also Undecidable?

1  Asked on November 17, 2021 by dshri

### Is English Turing-complete?

3  Asked on November 15, 2021

### If factor isn’t found in P-1 algorithm, should upper bound be increased linearly (i.e. +1)

0  Asked on November 13, 2021 by northerner

### Can map-reduce speed up the count-min-sketch algorithm?

1  Asked on November 11, 2021 by pragya

### Maximization problem on finite collection of finite sets

1  Asked on November 11, 2021 by yuezato

### Do there exist fast multiplication algorithms for two integers with one of them being static?

1  Asked on November 8, 2021 by john-flemin

### Convert the given NFA to DFA

2  Asked on November 5, 2021 by vinay-varahabhotla