Using Graphs to Model Problems, Part 1

OCW Scholar

« Previous | Next »

Session Overview


This lecture begins by finishing up k-means clustering. It then moves on to introduce the notion of modeling things using graphs (sets of nodes and edges that link them).

Session Activities

Lecture Videos

About this Video

Topics covered: Pseudocode, graphs, nodes, edges, adjacency matrix, adjacency list.


Check Yourself

What are filters used for?

View/hide answer

Filters allow us to choose which features to use for our classification, so that we are basing our inferences on the most relevant information (e.g. teeth instead of body size for dietary habits of mammals).



What is a graph?

View/hide answer

A set of objects called nodes (or vertices) connected by a set of edges (or arcs).



What is a digraph?

View/hide answer

A graph with unidirectional edges.



What is a weighted graph?

View/hide answer

A graph in which each edge has an associated weight.



Based on the code in the handout, why is Graph a subclass of Digraph, rather than the other way around?

View/hide answer

Edge has a source and destination, and is therefore unidirectional already. This makes it easier for us to treat the bidirectional case Graph (where there is an edge for each direction) as a special case of Digraph.



« Previous | Next »