Types of Graph
Undirected Graph
An undirected graph consists of 2 finite sets: a nonempty set of vertices and a set of edges, where each edge is associated with a set consisting of either one or two vertices called its endpoints.
An edge is said to connect its endpoints. Two vertices that are connected to an edge are called adjacent vertices (vertices can be adjacent to themselves).
An edge is said to be incident on each of its endpoints, and two edges incident on the same endpoint are called adjacent edges.
Denoted where
- is the set of vertices (or nodes) in
- is the set of undirected edges in
- An undirected edge connecting and is denoted
Directed Graph
Definition is same as Undirected Graph, except is a set of ordered pairs, representing directed edges. An edge from to is
Subgraph
A graph is said to be a subgraph of iff every vertex in is also a vertex in , every edge in is also an edge in , and has the same endpoints as it has in
Simple Graph
An undirected graph that does not have any loops or parallel edges (no pair of vertices has two edges between them)
Complete Graph
A complete graph on vertices, , denoted is a simple graph with vertices and exactly one edge connecting each pair of distinct vertices. has edges.
Bipartite Graph
(or bigraph) is a simple graph whose vertices can be divided into two disjoin sets and such that every edge connects a vertex in to one in
Complete Bitartite Graph
A bigraph on two disjoint sets and such that every vertex in connects to every vertex in . If and , the complete bipartite graph is denoted as
Definitions
Degree of Undirected Graph
- Degree of vertex , denoted deg() is the number of edges that are incident on , with an edge that is a loop counted twice.
- Total degree of is the sum of the degrees of all the vertices of
Indegree and Outdegree of Directed Graph
- Indegree of vertex denoted is the number of directed edges that end at
- Outdegree of vertex denoted by is the number of directed edges that originate from
Traversing
- Walk: a walk from to is a finite alternating sequence of adjacent vertices and edges of
- It has the form where and for all and are the endpoints of
- The number of edges is the length of the walk
- The trivial walk from to consists of the single vertex
- Trail: a walk that does not contain a repeated edge
- Path: a trail that does not contain a repeated vertex
- Closed Walk: a walk that starts and ends at the same vertex
- Cycle or circuit: a closed walk of length at least 3 that does not contain a repeated edge
- Simple cycle or simple circuit: a circuit that does not have any other repeated vertex except its first and last
- Cyclic: An undirected graph is cyclic if it contains a loop or cycle. Otherwise, it is acyclic
Euler Circuit
- An euler circuit for is a circuit that contains every vertex and traverses every edge of exactly once
- An eulerian graph is a graph that contains an euler circuit
- Theorem 10.2.2: If a graph has an Euler circuit, then every vertex of the graph has positive even degree (contrapositive: if some vertex of a graph has odd degree, then the graph does not have an euler circuit)
- Theorem 10.2.3: If a graph is connected and the degree of every vertex of is a positive even integer, then has an euler circuit
- Theorem 10.2.4: A graph has an euler circuit iff is connected and every vertex of has positive even degree
Euler Trail/path
- An euler trail/path from to is a sequence of adjacent edges and vertices that starts at , ends at , passes through every vertex of at least once, and traverses every edge of exactly once. (Euler circuit but doesn’t need to start and end at the same vertex)
- Corollary 10.2.5: There is an euler trail from to iff is connected, and have odd degree, and all other vertices of have positive even degree
Hamiltonian Circuit
- A simple circuit that includes every vertex of (every vertex appears exactly once, except for the first and the last, which are the same)
- Hamiltonian graph: a graph that contains a hamiltonian circuit
- Proposition 10.2.6: If graph has a hamiltonian circuit, then it has a subgraph with the following properties
- contains every vertex of
- is connected
- has the same number of edges as vertices
- Every vertex of has degree 2
Connectedness
- Two vertices of a graph are connected iff there is a walk from to
- The graph is connected iff for any two vertices and in , there is a walk from to
- A graph is a connected component of a graph iff all of the following:
- The graph is a subgraph of
- The graph is connected
- No connected subgraph of has as a subgraph and contains edges or vertices that are not in (It is the biggest possible, contains as many edges and vertices as possible)
- Lemma 10.2.1
- If is connected, then any two distinct vertices of can be connected by a path
- If vertices and are part of a circuit in and one edge is removed from the circuit, then there still exists a trail from to in
- If is connected and contains a circuit, then an edge of the circuit can be removed without disconnecting
Handshake Theorem
Theorem 10.1.1: The total degree of a graph is 2 times the number of edges of
- The total degree of a graph is even
- In any graph, there are an even number of vertices of odd degree
Matrix representation of graph
Note: represents the element at the ith row and jth column of A. A matrix has m columns and n rows
Adjacency Matrix
Let be a directed graph with ordered vertices
The adjacency matrix of is the matrix over the set of non-negative integers such that: the number of arrows from to for all
i.e. the element at the ith row and jth column is the number of edges from the ith vertex to the jth vertex
Note: an adjacency matrix of an undirected graph is symmetric (about the top-left to bottom-right diagonal)
Counting walks of length n
Theorem 10.3.2: If is the adjacency matrix of a graph, the i j-th entry of is the number of walks of length connecting the ith and jth vertices of the graph.
Matrix Operations
Scalar Product
The scalar product or dot product of the ith row of and jth column of (where the number of elements in both are the same) is the sum of the individual products ()
Matrix multiplication
The matrix product of and (number of cols in must be the same as the number of rows in ).
The matrix product is a matrix where the element is the scalar product of row i of matrix and column j of matrix
Identity matrix
The main diagonal is all 1s, the rest is 0.
power of a matrix
For matrix , , so
Isomorphism of graphs
Let and be two graphs.
is isomorphic to , denoted iff there exists bijections: and that preserve the edge-endpoint functions of and in the sense that for all and , is an endpoint of is an endpoint of
(The graphs have the same shape after re-arranging)
Alternately: Let and be two simple graphs. is isomorphic to iff there exists a permutation (function) such that
Theorem 10.4.1: Graph isomorphism is an equivalence relation
Planar Graph
A planar graph can be drawn on a two-dimensional plane without edges crossing
Kuratowski’s Theorem
A finite graph is planar iff it does not contain a subgraph that is a subdivision of the complete graph or the complete bigraph (subdivision: a graph that is made by placing a vertex along any edge to turn it into two edges)
Euler’s Formula
For a connected planar simple graph with and , if we let be the number of faces, then (a face is a region bound by edges of a planar graph when it is drawn without overlapping edges. note: the area outside the whole graph is counted as a face)