Chapter 38 - Graphs Flashcards
What is a graph?
» An abstract data structure which are representing a complex relationship
» A set of vertices or nodes connected by adges or arcs
What is traversal?
» It is essentially the ‘cost’ of movement around the graph
What are the features of an undirected graph?
» Consists of nodes
» All edges are bidirectional - meaning they can go any direction
What is an edge?
» Represents a path/link between 2 nodes
What is an arc?
» Another name for an edge
What is a vertex?
» Each data item within a graph
What is a node?
» Another name for a vertex
What is a weighted edge?
» Edges that have some value, attached to them
» Shows the cost of traversing
What are the features of a directed graph?
» Shows direction - can be bidirectional
» Consists of nodes
What are the 2 possible implementations of a graph?
» Adjacency matrix
» Adjacency list
What does each row and column represent in a adjacency matrix?
» A node
What is the order of a matrix?
» Row then column
What is an adjacency matrix?
» A table showing which nodes in a graph are connected and if the edges are weighted
» Elements of the matrix indicate whether pairs of vertices are adjacent or not in the graph
What will the adjacency matrix be in an undirect graph?
» Symmetric
How can an unweighted graph be represented in a matrix?
» May be represented with 1s instead of weights