Graph Search Flashcards

1
Q

Undirected Graph vs Directed

A

Directed graphs have arrows.

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

Tree Graph aka Acyclic

A

Undirected graph that is connected and has no cycles. If it had cycles it would be a graph.

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

Rooted Tree

A

This has one vertex that is distinguished and it’s nodes are called leaves.

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

Connected Components

A

In a graph that is not connected.

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

Forests

A

Undirected. The connected compontents in a forest are trees. Forests don’t have cycles.

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

Spanning Tree

A

Applications to the design of communication networks They’re a spanning subgraph that is a tree. They connect all the vertices with a minimum number of edges.

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

Paths

A

A sequence of nodes with a start point and end-point.

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

Pathfinding

A

Could be more than one path from one node to the other. Path length is of interest and finding the shortest one is a common graph operation.

These operations will find paths from one node to another by traversing:
BFS - Breadth first search
DFS - Depth first search
The algorithm will find all the paths.

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

Cycles

A

Cycles in a graph are paths from a node back to itself and must be avoided when traversing a graph as it will be in a constant loop.

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

Breadth-first Search

A

This is useful for finding the shortest path on an unweighted graph. It first creates an empty queue.

BFS starts with a node and explores the neighbour nodes first. (It explores nodes in layers).

It does this by maintaining queues of which nodes to visit next.

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

BFS Runtime Complexity?

A

BFS on a graph with n vertices and m edges takes O(N+m) time.

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

The queue process of BFS

A

First node goes into a queue. The neighbours of this node are put into the queue. These are then searched for their neighbours which are then added to the queue. When a node is found to have no neighbours it is removed from the queue.

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

DFS

A

This isn’t useful alone. This is useful for counting connected components, determining connectivity, and finding bridges and articulation points.

DFS is good for a single solution such as a maze (backtracking etc). It’s harder than BFS to parallellise. Uses a stack rather than a queue like BFS.

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

Weighted Graphs

A

Graphs that have weight on their edges. They can represent costs and distances etc. You can find the total weight of the graph by using these weights.

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

Minimum Spanning Tree

A

Finding the minimum weight for a tree.

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

Prim’s Alogrithm

A

MST. Runtime is O((V+E) logV).