Introduction to graphs

Published

2023-08-05

Introduction to graphs. Here we introduce graphs, we recall that trees are a specific type of graph—an acyclic, undirected, connected graph, and we present two representations of graphs we can use in our algorithms—adjacency list and adjacency matrix.

Note that I have annotated the PDF of the slides used in this presentation to correct two deficiencies.

First, the video uses E as symbol for the edge set, but then there’s a node labeled E. These are not the same E. I should have used a script E for the edge set, or avoided the use of E as a node label.

Generally, we write G = (V, E), to denote a graph. That is, the graph G, is defined by its node (or vertex) set, V, and its edge set E. I will avoid using E as a node label in future videos.

Second, while I made it clear that in the case of undirected graphs that when we use the two node form to refer to edges, e.g. the undirected edge between nodes A an B can be written as AB or BA equivalently. However, this is not the case for directed edges. If the edges are directed then AB is different from BA. They are two different edges! In the directed case, AB refers to an edge from A to B (and not the other direction), and BA refers to an edge from B to A (and not the other direction).

Sneak Preview. This is an optional, supplemental introduction to complete graphs, bipartite graphs, independent sets (in a graph), matchings, and incidence matrix representations of graphs. You will not be assessed on the material here.

Resources:

Comprehension check:

  1. Graph G has node set \{A, B, C, D, F\} and undirected edge set \{AC, AB, AF, BD\}. Is G a tree?
  2. Graph G has a node set \{A, B, C, D, F\} and directed edge set \{AB, BD, FA, AC, DF\}. Does G contain a cycle?
  3. Graph G has a node set \{A, B, C, D, F\} and the set, S, containing \{AD, AC, CD, AF\} is a subset of G’s edge set. That is S = \{AD, AC, CD, AF\} and S \subseteq E. Is it possible that G is a tree?
  4. Graph G has node set \{A, B\} and a directed edge set \{AB\}. Is B adjacent to A?
  5. Graph G has node set \{A, B, C, D, F, H\} and undirected edge set \{AB, BC, BH, CH, CF, FH, HD, DA\}. Given an adjacency list representation of G, what entries should we find in the list corresponding to node B?
  6. Given the same graph G in the example above (#5), given an adjacency matrix representation of G, what is the sum of the column for node C?
  7. Given the same graph G in the example above (#5), given an adjacency matrix representation of G, denoted M, what is the value of M_{D,H}?

Answers: Ɩ / Ɛ / (ʞo sɹǝpɹo ɹǝɥʇo) H’Ɔ’∀ / ou / ou / (Ⅎpq∀) sǝʎ / sǝʎ

Original author: Clayton Cafiero < [given name] DOT [surname] AT uvm DOT edu >

No generative AI was used in producing this material. This was written the old-fashioned way.

All materials copyright © 2020–2023, The University of Vermont. All rights reserved.