Graphs: Examples and Definitions

Week 13, Monday

March 30, 2026

Announcements

What’s left?

How do we get from here to there? Need:

1. Common Vocabulary

2. Graph implementation

3. Traversal

4. Algorithms.

Collaboration Graph

Graph (V,E):

   V:   ___________________

   E:   ___________________

 

Sparse Graph:

\(|E| = O(|V|)\)

Downtown Vancouver

Graph (V,E):

   V:   ___________________

   E:   ___________________

 

Directed Graph: each edge \((u,v)\) is ordered — \((u,v) \neq (v,u)\). Streets like Howe (↓) and Seymour (↑) make this directed.

Weighted Graph: each edge carries a weight \(w(u,v)\) — here, travel time in minutes.

In/Out-degree(v): # edges directed into / out of \(v\). A one-way intersection has in-degree \(\neq\) out-degree.

 

Fastest route: Seymour & Georgia → Burrard & Helmcken?

Graph Vocabulary

b a c e d g f n m o k l j i h p q 8 9 6 7 4 5 2 3 0 1 G = (V,E) |V| = n |E| = m
  1. List the edges incident on vertex b:
  2. What is the degree of vertex h?
  3. List all vertices adjacent to vertex i:
  4. Describe a path from p to o:
  5. Describe a path from 6 to g:
  6. List the vertices in the largest complete subgraph in G:
  7. Describe the largest connected subgraph in G:
  8. Describe the connected components in G:
  9. How many edges in a spanning forest of G?
  10. How many paths from 0 to 9?
  11. Can you draw G with no crossing edges?

Bounds

\(G = (V,E) \qquad |V| = n \qquad |E| = m\)

Running times are often reported in terms of \(n\), the number of vertices, but they often depend on \(m\), the number of edges.

 

Suppose \(n = 100\) vertices…

 

Give a lower bound on \(|E|\):   ______

 

Give an upper bound on \(|E|\):   ______

Handshaking

\(G = (V,E) \qquad |V| = n \qquad |E| = m\)

How many edges?

Activity: Pencil Puzzles

You each have a graph. Do these three things:

  1. Sketch the graph given on your card.

  2. Try to trace every edge exactly once without lifting your pencil.

  3. Come up with a rule that you can use to determine if a trace is possible.

  4. Speculate on an algorithm that will find a trace if it exists.

What’s left?

How do we get from here to there? Need:

1. Common Vocabulary

2. Graph implementation

3. Traversal

4. Algorithms.