Graphs and Trees
Intro & Reference
This note briefly goes over some (i.e. not all) topics about graphs and trees. There are links to my other posts in this note for additional details such as proofs of theorems and application of various ideas.
Reference: Discrete Mathematics 8th Ed by Richard Johnsonbaugh.
Part 1. Graph
1. Graph & Simple Graph
- A graph (or an undirected graph) G G G consists of a set V V V of vertices and a set E E E of edges such that each edge e ∈ E e \in E e∈E is associated with an unordered pair of vertices. If there is a unique edge e e e associated with the vertices v v v and w w w, we write e = ( v , w ) e = (v,w) e=(v,w) or e = ( w , v ) e = (w,v) e=(w,v). In this context, ( v , w ) (v,w) (v,w) denotes an edge between v v v and w w w in an undirected graph and not an ordered pair. If a graph has vertices V V V and edges E E E, we write G = ( V , E ) G=(V,E) G=(V,E).
- For a graph G = ( V , E ) G=(V,E) G=(V,E) and v , w ∈ V v,w \in V v,w∈V, we say v v v and w w w are adjacent to each other iff there exists some edge e ∈ E e\in E e∈E that is incident on v v v and w w w.
- Parallel edges in a graph are edges that are incident on the same pair of vertices.
- A loop in a graph is an edge that is incident on only one vertex.
- With the definitions of a graph, parallel edges, and a loop, we can then define simple graph so that we restrict future discussions to this “simple” type of graph:
A simple graph is a graph with no loops or parallel edges. - Notice we can still have a “lone” vertex be part of a graph:
An isolated vertex is a vertex that is not incident on any edges (so it is also not adjacent to any other vertices). - When we have a numerical weight (and thus non-negative because we typically do not have negative weights) assigned to each vertex of a graph, the graph becomes a weighted graph.
2. Ways to Represent a Graph
- We will use an example to illustrate ways to represent a graph G G G:
- The first way is to picture the graph:
- The second way is to define the graph by G : = ( V , E ) G:=(V,E) G:=(V,E) where V : = { a , b , c } , E : = { ( a , b ) , ( b , c ) , ( a , c ) } V:=\{a,b,c\}, E:=\{(a,b),(b,c),(a,c)\} V:={
a,b,c},E:={
(a,b),(b,c),(a,c)} (the order does not matter).
Remark:If we have drawn and properly labled our graph like we did above, we can write E E E as { e 1 , e 2 , e 3 } \{e_1,e_2,e_3\} { e1,e2,e3} . - Moreover, we can use an adjacency matrix to represnt the graph above, and the ordering of the vertices we choose is ( a , b , c ) (a,b,c) (a,b,c). a b c a 0 1 1 b 1 0 1 c 1 1 0 \begin{matrix} ~ & a & b &c \\ a & 0 & 1 & 1 \\ b & 1 & 0 & 1\\ c & 1 & 1 & 0 \end{matrix} abca011b101c110
3. Path & Simple Connected Graph
The graphs we are primarily interested in are the simple connected graphs. We are going to define it by first introducing path.
-
For v 0 , v n ∈ V v_0,v_n\in V v0,vn∈V in a graph G : = ( V , E ) G:=(V,E) G:=