STCON in Directed Unique-Path Graphs Sampath Kannan Sanjeev Khanna Sudeepa Roy University of...

23
STCON in Directed Unique- Path Graphs Sampath Kannan Sanjeev Khanna Sudeepa Roy University of Pennsylvania 1

Transcript of STCON in Directed Unique-Path Graphs Sampath Kannan Sanjeev Khanna Sudeepa Roy University of...

Page 1: STCON in Directed Unique-Path Graphs Sampath Kannan Sanjeev Khanna Sudeepa Roy University of Pennsylvania 1.

STCON in Directed Unique-Path Graphs

Sampath Kannan

Sanjeev Khanna

Sudeepa Roy

University of Pennsylvania

1

Page 2: STCON in Directed Unique-Path Graphs Sampath Kannan Sanjeev Khanna Sudeepa Roy University of Pennsylvania 1.

(Directed) st-connectivity (STCON)

s

tt

2

directed path from s to t in G?

Page 3: STCON in Directed Unique-Path Graphs Sampath Kannan Sanjeev Khanna Sudeepa Roy University of Pennsylvania 1.

Open Questions

O(log n) space algorithm for STCON? (L = NL!)

Time-space tradeoff analysis

Known Results NL-complete O(n) space and O(m+n) time (BFS or DFS) O(log2 n) space and O(nlog n) time (Savitch) USTCON L (Reingold’04)

Questions involving STCON

3

Page 4: STCON in Directed Unique-Path Graphs Sampath Kannan Sanjeev Khanna Sudeepa Roy University of Pennsylvania 1.

Time-Space Trade-off for STCON

4

Sublinear-space poly-time algorithm for STCON?

Space () Time ()

BFS/DFS

Barnes et al ’98

?

Savitch

O(n) O(m+n)

n / 2(√log n) poly-time

O(nε), ε < 1 poly-time

O(log2 n) O(nlog n)

Page 5: STCON in Directed Unique-Path Graphs Sampath Kannan Sanjeev Khanna Sudeepa Roy University of Pennsylvania 1.

(Poly-time) STCON in Special Graphs

s

UL or Unambiguous Logspace

Unique computation path from start to accepting configuration

5

Tree: O(log n)-spaceStrongUL: O(log2 n / log log n)-space (AL’98)ReachUL: O(log2 n / log log n)-space (AL’98)

Can we allow some cycles reachable from s?

Unique-Path Graphs

Page 6: STCON in Directed Unique-Path Graphs Sampath Kannan Sanjeev Khanna Sudeepa Roy University of Pennsylvania 1.

Back Edges, Forward Edges and Cross Edges

s

6

Tree Edge

Back Edge

Forward Edge

Cross Edge

Page 7: STCON in Directed Unique-Path Graphs Sampath Kannan Sanjeev Khanna Sudeepa Roy University of Pennsylvania 1.

At most one directed simple path from s to any vertex

Unique-Path Graphs

ss

No forward edge or cross edge in DFS-tree from any vertex reachable from s

v

7

Page 8: STCON in Directed Unique-Path Graphs Sampath Kannan Sanjeev Khanna Sudeepa Roy University of Pennsylvania 1.

Main Theorem

In unique-path graphs, STCON is solvable in O(nε/ε) space and nO(1/ε) time for any ε (0, 1]

Poly-time, O(nε) space algorithm for constant ε

“Small-space implementation” of DFS

8

Page 9: STCON in Directed Unique-Path Graphs Sampath Kannan Sanjeev Khanna Sudeepa Roy University of Pennsylvania 1.

Space Requirement in Standard DFS Linear space needed to remember

where to backtrack to from a vertex

if a vertex has been already visited

9

Backtrack Step

Discovery Step

Goal: Implement “backtrack step” and “discovery step” in poly-time and sublinear space

Page 10: STCON in Directed Unique-Path Graphs Sampath Kannan Sanjeev Khanna Sudeepa Roy University of Pennsylvania 1.

Plan for Rest of the Talk …

An O(√n)-space algorithm Backtrack Step in O(√n) space Discovery Step in O(√n) space

Extension to O(nε)-space algorithm

Recognition of unique-path graphs

10

Page 11: STCON in Directed Unique-Path Graphs Sampath Kannan Sanjeev Khanna Sudeepa Roy University of Pennsylvania 1.

√n-bounded DFS

Backtrack when length of exploration path > √n

Visits all and only the vertices within √n distance

O(√n)-space implementation in unique-path graphs

11

Page 12: STCON in Directed Unique-Path Graphs Sampath Kannan Sanjeev Khanna Sudeepa Roy University of Pennsylvania 1.

Landmark Vertices

Vertices evenly spaced at √n distance from s along the current exploration path

s = z0

z1

z2

√n

√n

x

12

Can be stored in O(√n) space

Page 13: STCON in Directed Unique-Path Graphs Sampath Kannan Sanjeev Khanna Sudeepa Roy University of Pennsylvania 1.

Backtrack Step

Backtrack(v)

Z = last landmark vertex

u = parent(v) iff v is not reachable from z in G – (u, v) by a √n-bounded DFS.

IN(v) y x u

y

v

x

z

u

IN(v) y x u IN(v) y x u IN(v) y x u

≤ √n

O(√n)-space implementation

13

s

Page 14: STCON in Directed Unique-Path Graphs Sampath Kannan Sanjeev Khanna Sudeepa Roy University of Pennsylvania 1.

Discovery Step

discovery (u, v) ≡ (u, v) is a back edge

do a √n-bounded DFS from v

zi = highest indexed landmark vertex reached

do a √n-bounded DFS from zi-1

(u, v) is a back edge iff v is reached before zi

v

u

√n

vO(√n)-space implementation

zi-1

zi

14

s

Page 15: STCON in Directed Unique-Path Graphs Sampath Kannan Sanjeev Khanna Sudeepa Roy University of Pennsylvania 1.

O(√n)-space O(nε)-space

No. of Landmark vertices

Spacing between landmark vertices

Backtrack and discovery steps

O(nε)-space Poly-time Algorithm

15

√n

√n

O(√n)

n1- ε

Backtrack and discovery steps use reachability queries

O(nε)

Page 16: STCON in Directed Unique-Path Graphs Sampath Kannan Sanjeev Khanna Sudeepa Roy University of Pennsylvania 1.

O(nε)-space Poly-time Algorithm Backtrack(x)

suppose z is the last landmark vertex on the exploration path to v.

for any u IN(v), v is not reachable from z in G – (u, v) by a √n-bounded DFS iff u is parent of x

y

v

x

z

u

n1- ε-bounded DFS (recursively)

Example

√n

n1- ε

Reach(z, v, G–(u, v), n1- ε)? Reach(s, t, G, n-1)?

16

Page 17: STCON in Directed Unique-Path Graphs Sampath Kannan Sanjeev Khanna Sudeepa Roy University of Pennsylvania 1.

O(nε)-space Poly-time Algorithm

O(m) calls to n1- ε -bounded reachability queries

T(n) ≤ cm T(n1- ε) + O(m+n)

T(n) = nO(1/ε)

O(nε/ε) space

17

Page 18: STCON in Directed Unique-Path Graphs Sampath Kannan Sanjeev Khanna Sudeepa Roy University of Pennsylvania 1.

Other Results

18

Recognize unique-path graphs in poly-time and O(nε) space

Page 19: STCON in Directed Unique-Path Graphs Sampath Kannan Sanjeev Khanna Sudeepa Roy University of Pennsylvania 1.

Recognize Unique-Path Graphs Simpler Problem:

Either solve STCON correctly or report that the graph is not a unique-path graph

19

DFS from any vertex reachable from s does not produce any forward or cross edge

Page 20: STCON in Directed Unique-Path Graphs Sampath Kannan Sanjeev Khanna Sudeepa Roy University of Pennsylvania 1.

Solve STCON or Detect Violation

Should be correct as long as it runs Should be poly-time

Ideally: should not revisit vertices Even if revisits vertices poly-time should be enforced

20

Run previous algorithm as long as no forward or cross edge is detected

√n-bounded DFS can be modified to work correctly

Page 21: STCON in Directed Unique-Path Graphs Sampath Kannan Sanjeev Khanna Sudeepa Roy University of Pennsylvania 1.

Detect Forward/Cross Edges

21

√n v

u

v

zi-1

zi

≤ √n Forward edges are easy to

detect ‘Some’ cross edges are

also easy to detect Other cross edges we

cannot detect They do not affect

correctness Run a clock to ensure

poly-time

> √n

Can be extended further to recognize Unique-Path Graphs

Page 22: STCON in Directed Unique-Path Graphs Sampath Kannan Sanjeev Khanna Sudeepa Roy University of Pennsylvania 1.

22

Poly-log space poly-time algorithm for unique-path graphs?

Poly-log space poly-time algorithm for other directed graphs? O(log n)-space algorithm for regular directed graphs –

RTV’06 O(log n)-space algorithm for single source multiple

sink planar directed graphs – Allender et. al.’06

O(nε)-space poly-time algorithm for general directed graphs?

Open Problems

Page 23: STCON in Directed Unique-Path Graphs Sampath Kannan Sanjeev Khanna Sudeepa Roy University of Pennsylvania 1.

Thank You

23