Graph Traversal Flashcards

1
Q

DFS, BFS

A

O(V+E)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

PRE

A

ROOT, LEFT, RIGHT

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

IN

A

LEFT, ROOT, RIGHT

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

POST

A

LEFT, RIGHT, ROOT

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

DFS and BFS always runs O(v^2) on

A

Complete Graph

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Check Tree or Not

A
  1. At least one node without income
  2. Number of edges exactly be n-1
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Topological order

A
  1. Shouldn’t have cycles
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Colors

A

Blue - visited,
Orange - back tracked or end

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

If black edge and next node is visited then cycle

A

First all edges are black, mark as orange after traversal

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

order

A

BFS - level order
DFS - pre order traversal

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Visit and explore

A

visit the node and explore of each child node

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

DFS and BFS can run in O(V^2)

A

DAG, Bipartite Graph, Complete Graph

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Topological

A

Graph should be DAG
https://www.youtube.com/watch?v=cIBFEhD77b4

https://www.youtube.com/watch?v=dis_c84ejhQ

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

A graph can have many topological sort orders

A

yes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly