Back to marketplace

Chapter 38 - Graphs

No description yet. This curated deck is ready for daily study.

Total cards: 24•Content version: v4•Public deck•Updated: 8/1/2026

Card preview (24)

#1
Front (Question)

What is a graph?

Back (Answer)

» An abstract data structure which are representing a complex relationship » A set of vertices or nodes connected by adges or arcs

#2
Front (Question)

What is traversal?

Back (Answer)

» It is essentially the ‘cost’ of movement around the graph

#3
Front (Question)

What are the features of an undirected graph?

Back (Answer)

» Consists of nodes » All edges are bidirectional - meaning they can go any direction

#4
Front (Question)

What is an edge?

Back (Answer)

» Represents a path/link between 2 nodes

#5
Front (Question)

What is an arc?

Back (Answer)

» Another name for an edge

#6
Front (Question)

What is a vertex?

Back (Answer)

» Each data item within a graph

#7
Front (Question)

What is a node?

Back (Answer)

» Another name for a vertex

#8
Front (Question)

What is a weighted edge?

Back (Answer)

» Edges that have some value, attached to them » Shows the cost of traversing

#9
Front (Question)

What are the features of a directed graph?

Back (Answer)

» Shows direction - can be bidirectional » Consists of nodes

#10
Front (Question)

What are the 2 possible implementations of a graph?

Back (Answer)

» Adjacency matrix » Adjacency list

#11
Front (Question)

What does each row and column represent in a adjacency matrix?

Back (Answer)

» A node

#12
Front (Question)

What is the order of a matrix?

Back (Answer)

» Row then column

#13
Front (Question)

What is an adjacency matrix?

Back (Answer)

» 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

#14
Front (Question)

What will the adjacency matrix be in an undirect graph?

Back (Answer)

» Symmetric

#15
Front (Question)

How can an unweighted graph be represented in a matrix?

Back (Answer)

» May be represented with 1s instead of weights

#16
Front (Question)

How can a weighted graph be represented in a matrix?

Back (Answer)

» Instead of 1s, there can be the value of the weight

#17
Front (Question)

What are the advantages of an adjacency matrix?

Back (Answer)

» Very convenient to work with » Adding edges is very simple

#18
Front (Question)

What are the disadvantages of an adjacency matrix?

Back (Answer)

» A sparse graph with not many connections will leave most of the cells empty, therefore wasting space » Using a static 2D array for it, it is harder to add or delete nodes

#19
Front (Question)

What is an adjacency list?

Back (Answer)

» A collection of unordered lists used to represent a finite graph » Each list describes the set of neighbours of a vertex in a graph

#20
Front (Question)

How does an adjacency list look like?

Back (Answer)

» A list of all the nodes are created » Each node points to a list where all the adjacent nodes to which is directly linked

#21
Front (Question)

When should an adjacency list be implemented as a dictionary?

Back (Answer)

» When it is weighted, with each key in the dictionary being the node and the value, the edge weight

#22
Front (Question)

What are the advantages of an adjacency list?

Back (Answer)

» Good way of representing a sparsely connected graph » More memory efficient

#23
Front (Question)

What are the disadvantages of an adjacency list?

Back (Answer)

» In the adjacency list, you need to list all the nodes that the node is connected to, in order to find the other node of the edge required. » Not time efficient

#24
Front (Question)

What is the page rank algorithm?

Back (Answer)

» An algorithm used by Google search to rank website in their search engine results