Graphs Flashcards
What is the definition of a graph?

What does adjacent mean in a graph? Draw an example.

What is the definition of an undirected graph?

What is the definition of a directed graph?

Explain how a tree is a directed graph

What is a path in a graph?

What is a cycle in a graph?

What does connected mean in a graph?

What does it mean for a graph to be complete?

What is a subgraph in a graph?

What type of information can the vertices represented in a graph?
What type of information can an edge represent in a graph?
Vertices
- The vertices in a graph may represent something(cities on a map, computers in a network)
- Vertices in a graph may contain information(information about the cities or computers represeted
Edges
- The edges may represent spatial connections between vertices or some other type of connection between the vertices.
- The edges may also contain information(distance between two cities, the cost of travel between two cities, capacity of a computer connection, weight of a connection in a neural network).
- If the information is a number, then the graph is called a weighted graph
In general, what is an Adjacency Matrix?

What is an example of an adjacency matric of an undirected graph?

What is an example of an adjacency matrix of a Digraph

What is an example of an adjacency matrix of a weighted graph?

What are the advantages and disadvantages of an adjacency matrix?

What is an adjacency list?
Show examples of undirected and digraphs.

What are the advantages and disadvantages of an adjacency list?

How do you decide to use an adjacency matrix or list?

What is the definition and two types of a graph traversal?

Perform a depth-first traversal of the following graph, draw the stack at each step.
What would the output be if we printed the contents of the vertex when we visit it?

Attached is an example of one step.
Output: 0, 1, 2, 4, 3, 6, 7, 5, 8, 9

Display the output and the stack for a depth-first traversal of this graph starting at 6.




What is the Pseudocode for a depth-first traversal?

What is a breadth-first traversal in a graph? Perform one on the following graph and print the output:

A breadth-first traversal visists all nearby vertices first before moving farther away. It is a queue-based, iterative traversal





What is the Pseudocode for a breadth-first traversal?

What needs to be done to record paths for a breadth-first traversal?

Traverse the following example and show how you would record the path for a breadth-first traversal.


What are connected components?

How does a traversal work for unconnected graphs?

What is the difference in the path that Depth-first and Breadth-first take?
