Graphs Flashcards
Graph Input Formats
What is an array of edges? Anything to note about it
An array of edges needs to be traversed over to create a lookup table for node neighbors.
The input type will be a 2D array in the format [x, y].
Graph Input Format
What is an adjacency list, anything important to note?
Just a 2D array of integer references neighbor nodes, the lookup table is already here for you!
Graph Input Type
What is the matrix input type, anything important to note?
These are unique to others because there is no set routine, nodes are not necessaily labeled from first to last.
This type is about problem comprehension.
Graph Input Types
What is an adjacency matrix, anything important to note?
Similar to an adjacency matrix, but the matrix is NxN. This means matrix[i][j] = 1
refers to an edge from i -> j.
One can also elect to traverse the graph at first and turn things into a hashmap, may help when N is large.