Graphs Flashcards

1
Q

What are graphs?

A

A general, non-linear data structure consisting of nodes (vertices) and edges between nodes.
G = (V, E)

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

Undirected Graph

A

There is no order to how the edges connect vertices.

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

Directed Graph

A

Each edge has a source vertex and target vertex.

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

Loop

A

An edge that connects a vertex to itself.

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

Path

A

A sequence of vertices such that each adjacent pair of vertices are connected by an edge.

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

Cycle

A

A simple path with no repeated vertices or edges other than the starting and ending vertices.

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

Directed Cycle

A

A cycle in a directed graph.

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

Weighted Graph

A

Has values on its edges.

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

Connected Graph

A

A graph that has a path between every pair of distinct vertices.

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

Complete Graph

A

A graph that has an edge between every pair of distinct vertices.

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

Disconnected Graph

A

Any graph that lacks a path between at least one pair of vertices.

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

Adjacent Vertices

A

Undirected: joined by an edge.
Directed: A is adjacent to B if the edge begins at B and ends at A.

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

Max # of edges (undirected)

A

n(n-1)/2

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

Max # of edges (directed)

A

n(n-1)

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

Adjacency Matrix

A

Array implementation of ADT graph. A square (n x n) grid of true/false values representing edges of the graph.

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

Adjacency List

A

List implementation of ADT graph.

17
Q

Adjacency Matrix Implementation

A

2-D array of Booleans. True = edge exists between vertex i to vertex j, otherwise false.

18
Q

Adjacency List Implementation

A

Directed: n linked lists represent the edges of n vertices.