Graphs Flashcards

1
Q

Graph

A

A set of vertices connected pairwise by edges.

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

Path

A

A sequence of vertices connected by edges.

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

Cycle

A

Path whose first and last vertices are the same.

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

Connected vertices

A

Two vertices are connected if there is a path between them.

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

Euler Tour

A

A cycle that uses each edge exactly once.

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

Hamilton tour

A

A cycle that uses each vertex exactly once.

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

Planar Graph

A

A graph that can be embedded in the plane.

I.e., it can be drawn on the plane in such a way that its edges intersect only at their endpoints.

I.e. it can be drawn in such a way that no edges cross each other.

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

Isomorphic Graphs

A

When two adjacency lists represent the same graph.

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

Sparse graphs

A

Graphs that have a huge number of vertices, but a small average vertex degree.

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

Describe

the Depth-first Search algorithm

A

DFS (to visit a vertex v)

  • Mark v as visited.
  • Recursively visit all unmarked vertices w adjacent to v.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

2 Applications of Depth-first search

A
  • Find all vertices connected to a given source vertex.
  • Find a path between two vertices.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Describe

the Breadth-first Search algorithm

A

BFS (from a source vertex s)

Put s on a FIFO queue, and mark s as visited.

Repeat until the queue is empty:

  • Remove the last recently added vertex v.
  • add each of v’s unvisited neighbours to the queue, and mark them as visited.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Define

vertex connectivity

A

Vertices v and w are connected if there is a path between them.

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

Digraph

A

Directed graph.

A set of vertices connected pairwise by directed edges.

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

Strongly connected vertices

A

Vertices v and w are strongly connected if there is both a directe path from v to w and a directed path from w to v.

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

Key property of strong vertex connectivity

A

Strong connectivity is an equivalence relation

  • v is strongly connected to v.
  • If v is strongly connected to w, then w is strongly connected to v.
  • If v is strongly connected to w and w to x, then v is strongly connected to x.
17
Q

Tree

A

A graph that is both connected and acyclic.

18
Q

Minimum spanning tree

A

Given an undirected graph G with positive edge weights (connected).

A spanning tree of G is a subgraph T that is both a tree (connected & acyclic) and spanning (includes all of the vertices).

19
Q

Define

a Cut

A

A cut in a graph is a partition of its vertices into two (nonempty) sets.

20
Q

Define

a Crossing edge

A

A crossing edge connects a vertex in one set with a vertex in the other.

21
Q

Define

Cut property

A

Given any cut, the crossing edge of minimum weight is in the minimum spanning tree.

22
Q

Describe

a proof for the cut property

A

Suppose the min-weight crossing edge e is not in the MST.

  • Adding e to the MST creates a cycle.
  • Some other edge f in the cycle must be a crossing edge.
  • Removing f and adding e is also a spanning tree.
  • Since the weight of e is less than the weight of f, that spanning tree is lower weight.
  • Thus we have a proof by contradiction.
23
Q

Describe

a Greedy algorithm to find a Minimum Spanning Tree

A

Def: Grey edges are not in the MST. Black ones are.

Start with all edges coloured grey.
Find a cut with no black crossing edges, and color its minimum-weight edge black.
Repeat until V-1 edges are coloured black.

(V being the number of vertices in the graph)

24
Q

Describe

Kruskal’s algorithm

to find the Minimum Spanning Tree

A

Sort edges in ascending order of weight.

Iterate through the edges:
- Add the next edge to tree T, unless doing so would create a cycle.

25
Q

What is the running time of Kruskal’s algorithm?

A

E log E

E being the number of edges in the graph

26
Q

Describe

Prim’s algorithm

to find the Minimum Spanning Tree

A
  • Start with vertex 0 and greedily grow tree T.
  • Add to T the min weight edge with exactly one endpoint in T.
  • Repeat until V - 1 edges.
27
Q

Describe

Dijkstra’s algorithm

to find the shortest path to any vertex

A

Consider connected vertices in increasing order of distance from the source vertex s (non-tree vertex with the lowest distTo[] value).

Add vertex to tree and relax all edges pointing from that vertex.

28
Q

Define

st-cut

A

A partition of the vertices into two disjoint sets, with s in one set A and t in the other set B.

29
Q

Define

the capacity of an st-cut

A

The sum of the capacities of the edges from A to B.

30
Q

Define

The net flow across a cut (A,B)

A

The sum of the flows on its edges from A to B minus the sum of the flows on its edges from B to A.

31
Q

Augmenting path theorem

A

A flow f is a maxflow iff there are no augmenting paths.

32
Q

Maxflow-mincut theorem

A

The value of the maxflow is equal to the capacity of the mincut.

33
Q

3 Equivalent conditions for any flow f

A
  • There exists a cut whose capacity equals the value of the flow f.
  • f is a maxflow.
  • There is no augmenting path with respect to f.
34
Q

Ford-Fulkerson Algorithm

A

Start with 0 flow.
While there exists an augmenting path:
- find an augmenting path
- compute bottleneck capacity
- increase flow on that path by bottleneck capacity