graphs Flashcards
1
Q
What is a graph?
A
A graph is a data structure consisting of a set of vertices/nodes connected by edges
2
Q
What is a directed graph?
A
A graph in which the edges can only be traversed in one direction.
3
Q
What is an undirected graph?
A
A graph in which the edges can be traversed in both directions.
4
Q
What is a weighted graph?
A
A graph in which the edges have a value when traversing
5
Q
Give two ways of representing graphs so that they can be understood by computers.
A
Adjacency Matrix, Adjacency List
6
Q
What are the advantages of using an adjacency matrix?
A
- Convenient to work with
- Easy to add new nodes to
7
Q
What are the advantages of using an Adjacency List?
A
Space efficient for large sparse networks