Week 9 Flashcards

1
Q

What are graphs?

A

Graphs are data structures where each node may have many predecessors and many successors.

Graphs are generalizations of tree structures, which are a generalization of linear structures.

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

What does a graph G=(V,E) consist of?

A

A graph consists of
* A non empty set of vertices(nodes)
* A (possibly) empty set of edges (arcs) that connect vertices.

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

What is an undirected graph?

A

Unordered pairs of graphs are unordered pairs of vertices.
* Edges represent an unordered relation between vertices
* Edges are represented undirected arcs
* Edges are always bidirectional.

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

What is a directed graph?

A

Ordered pairs of vertices
* edges represent direction between vertices
* Edges are represented by arrows.
* Edges are unidirectional, but can be bidirectional.

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

What does it mean for two vertices to be adjacent?

A

Two vertices are adjacent if an edge directly connects them.

If directed the first endpoint is the orgin, and the other is the destination.

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

What is incidence?

A

Incidence is a vertext edge pair such that the vertex is an endpoint of the edge.

An edge is indicent on a vertex if the vertex is one of the edge’s endpoints.

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

What is the degree of a vertex?

A

The degree of a vertex v is the number of incident edges on v.

Denoted deg(v)

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

What is it called when deg(v) = 0

A

v is an isolated vertex.
A graph can consist of entirely isolated vertices.

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

What is it called when two or more edges connecting the same 2 vertices?

A

Parallel, multiple edges, adjacent edges, and multiple adjacency.

Graphs containing these are called a multi-graph.

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

What is it called when an edge connects a vertex to itself?

A

It is called a self loop. A graph containing these loops is called a pseudograph.

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

What is a simple graph?

A

A simple graph contains no loops or parallel edges.

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

What is it called when an edge has an associated weight that measures the cost of traversing it.

A

It is called a weighted graph.

On diagrams, edges are labeled with their weights.

The weights need to be positive or real.

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

What is a path?

How do we measure an unweighted path length.

How about a weighted path length?

A

A path is a sequence of vertices connected by edges.

The unweighted path length is the number of edges on the path.

The weighted path length is the sum of costs of edges on the path.

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

What is a simple path?
What is a circuit?
What is a simple cycle?

A

In a simple path, each vertex occurs only once in the sequence.

In a circuit (cycle) is a path that begins and ends at the same vertex and no edges are repeated.

A simple cycle is a circuit where all vertices (except the first and the last) are different.

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

What happens in a connected graph?

A

There is a path between every pair of distinct vertices.

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

What is in a complete graph?

A

There is one edge connecting every pair of vertices.

17
Q

What is a directed acyclic graph (DAG).

A

Is a digraph containing no cycles.

18
Q

What is the basic idea of Depth First Search Graph Traversal?

A

Visit vertex v
Recursively visit each unvisted vertex adjacent to v

After backtracking, traverse any unvisted vertices using the same recursive process.

Vertices must include a field to indicate if it has been visited.

19
Q

What is the complexity for DFS in a graph?

A

Is O(|V| + |E|) for the adjacency list

Is O(|V^2|) for the adjacency matrix

20
Q

What is the basic idea of breadth first search in graphs?

A

Process the first vertex
Then process all its unvisted neighbor vertices
Then all unvisited neighbors of neighbors, etc.
Need a queue.

21
Q

What does DFS and BFS algorithms create?

A

They create a tree of nodes on path.
Or set of trees (forest) that include all vertices of the graph if repeated.

Called a spanning tree.
* edges included in this tree are called forward edeges (shown in solid lines)
* edges not included are called back edges. (indicated with dashed lines)