Graphs Flashcards

1
Q

What is a graph

A

Is a data structure that connects items in an interconnected network.

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

Strengths of a graph

A

Representing links. Graphs are ideal for cases where you’re working with things that connect to other things. Nodes and edges could, for example, respectively represent cities and highways, routers and ethernet cables, or Facebook users and their friendships.

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

Weaknesses of a graph

A

Scaling challenges. Most graph algorithms are O(n*lg(n)) or even slower. Depending on the size of your graph, running algorithms across your nodes may not be feasible.

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

Directed graph

A

Directed graphs have edges with direction. The edges indicate one-way relationship, in that edge can only be traversed in a single direction.

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

Undirected graph

A

Undirected graphs have edges that do not have a direction. The edges indicates a two-way relationship, in that each edge can be traversed in both directions.

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

Cyclic graph

A

Is a graph that has a cycle - an unbroken series of nodes with no repeating node or edges that connects back to itself.

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

Acyclic graph

A

Is a graph without cycles

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

Weighted graph

A

Is a graph where each edge has a “weight”. The weight could, for example, represent distance between two locations.

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

Unweighted graph

A

is a graph where each edge has not “weight”

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

Graph coloring

A

Is when you assign colors to each node in a graph

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

Legal coloring

A

Means that no adjacent nodes have the same color

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

Ilegal coloring

A

Means that some nodes have adjacent nodes with same color

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

Possible representations for graphs

A
  • Edge list
  • Adjacency list
  • Adjacency matrix
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Common algorithms for Graphs

A
  • Breath-first search (BFS)

- Depth-first search (DFS)

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

Some graph algorithms

A
  • Dijkstra’s Algorithm
  • Topological Sort
  • Minimum Spannin tree
How well did you know this?
1
Not at all
2
3
4
5
Perfectly