Graphs: Examples and Definitions
Announcements
Today: Graphs!

Graph (V,E):
V: ___________________
E: ___________________
Subgraph:
\(G'=(V',E')\) is a subgraph of \(G=(V,E)\) iff
\(V'\subseteq V\) and \(E'\subseteq E\) and
\((u,v)\in E'\to u\in V'\) and \(v\in V'\).
Degree(v):
number of edges that touch vertex \(v\).

Graph (V,E):
V: ___________________
E: ___________________
Aux: _________________
Adjacent Vertices, N(v): \(\{u:(u,v)\in E\}\)
Incident Edges, I(v): \(\{(u,v)\in E\}\)
Aside: _________________________

Graph (V,E):
V: ___________________
E: ___________________
Path:
sequence of vertices \(\{u_0,u_1,\ldots u_n\}\) where
\((u_i,u_{i+1})\in E,\;\forall i\in\{0\ldots n-1\}\)
How do we find solution?

Graph (V,E):
V: ___________________
E: ___________________
Aux: _________________
Planar Graph:
a graph that can be drawn in the plane
with no crossing edges.
Example: 3703
Walk: Sequence of vertices between which there are edges
Trail: Walk with no repeated edges
Path(alt): Walk with no repeated vertices
Circuit: Trail that begins and ends in same place
Cycle: Path that begins and ends in same place


Graph (V,E):
V: ___________________
E: ___________________
Complete Graph:
A graph \(G=(V,E)\) is complete iff \(\forall u,v\in V,\;(u,v)\in E\).

Graph (V,E):
V: ___________________
E: ___________________
Sparse Graph:
\(|E| = O(|V|)\)

Graph (V,E):
V: ___________________
E: ___________________
Directed Graph:
each edge \((u,v)\) is ordered: \((u,v) \neq (v,u)\).
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\).
Fastest route:
Seymour & Georgia → Burrard & Helmcken?

\(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|\): ______

\(G = (V,E) \qquad |V| = n \qquad |E| = m\)
How many edges?
You each have a graph. Do these three things:
Try to trace every edge exactly once without lifting your pencil.
Come up with a rule that tells you if a trace is possible.
Devise an algorithm that will find a trace if it exists.

How do we get from here to there?
Need:
1. Common Vocabulary
2. Graph implementation
3. Traversal
4. Algorithms.
CPSC 221
Social Network
Graph (V,E):
V: ___________________
E: ___________________
Connected (sub)graph:
a (sub)graph \(G=(V,E)\) is connected if
there is a path from \(u\) to \(v\), \(\forall u,v\in V\).
Connected Component:
a maximal connected subgraph.
Spanning Tree:
connected, acyclic subgraph,
containing all the vertices in \(V\).