Graphs Flashcards
(6 cards)
What are graphs made up of ?
Nodes,
Edges.
What are the three types of graphs ?
Undirected Graphs - Edges have no direction,
Directed Graphs - Edges have a specific direction,
Weighted Graphs - Edges have associated weights or costs.
What is the difference between a path and a simple path ?
A path is a sequence of nodes connected by edges,
A simple path is a path that does not revist nodes.
What is a connected graphs ?
Ever node can reach every other node.
What is an Adjacency matrix ?
2D array representation,
Matrix[i][j] = 1 if there is an edge, 0 if otherwise,
Efficient for dense graphs.
What is an Adjancency List ?
Array of linked lists where each list contains a node’s neighbours.
Efficient for sparse graphs.