




























































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Explain in graph theory: Theorems, representation of graphs data structures, traversal, graph optimization and planarity and colorings.
Typology: Slides
1 / 120
This page cannot be seen from the preview
Don't miss anything!
Discrete Mathematics
Fall 2019
(^1) Definitions
2 Theorems
(^3) Representations of Graphs: Data Structures
(^4) Traversal: Eulerian and Hamiltonian Graphs
(^5) Graph Optimization
6 Planarity and Colorings
Two vertices that are joined by an edge are called adjacent vertices.
A pendant vertex is a vertex that is connected to exactly one other vertex by a single edge.
A walk in a graph is a sequence of alternating vertices and edges v 1 e 1 v 2 e 2... vnenvn+1 with n ≥ 0. If v 1 = vn+1 then the walk is closed. The length of the walk is the number of edges in the walk. A walk of length zero is a trivial walk.
A trail is a walk with no repeated edges. A path is a walk with no repeated vertices. A circuit is a closed trail and a trivial circuit has a single vertex and no edges. A trail or circuit is Eulerian if it uses every edge in the graph.
A cycle is a nontrivial circuit in which the only repeated vertex is the first/last one.
A simple graph is a graph with no loop edges or multiple edges. Edges in a simple graph may be specified by a set {vi , vj } of the two vertices that the edge makes adjacent. A graph with more than one edge between a pair of vertices is called a multigraph while a graph with loop edges is called a pseudograph.
A graph is connected if there is a walk between every pair of distinct vertices in the graph.
A graph H is a subgraph of a graph G if all vertices and edges in H are also in G.
A connected component of G is a connected subgraph H of G such that no other connected subgraph of G contains H.
A graph is called Eulerian if it contains an Eulerian circuit.
A tree is a connected, simple graph that has no cycles. Vertices of degree 1 in a tree are called the leaves of the tree.
Let G be a simple, connected graph. The subgraph T is a spanning tree of G if T is a tree and every node in G is a node in T.
A weighted graph is a graph G = (V , E ) along with a function w : E → R that associates a numerical weight to each edge. If G is a weighted graph, then T is a minimal spanning tree of G if it is a spanning tree and no other spanning tree of G has smaller total weight.
Simple graphs G and H are called isomorphic if there is a bijection f from the nodes of G to the nodes of H such that {v , w } is an edge in G if and only if {f (v ), f (w )} is an edge of H. The function f is called an isomorphism.
A simple, connected graph is called planar if there is a way to draw it on a plane so that no edges cross. Such a drawing is called an embedding of the graph in the plane.
For a planar graph G embedded in the plane, a face of the graph is a region of the plane created by the drawing. The area of the plane outside the graph is also a face, called the unbounded face.
Let G be a connected graph. Then G is Eulerian if and only if every vertex in G has even degree.
In any graph with n vertices vi and m edges
∑^ n
i=
deg(vi ) = 2m
A connected non-Eulerian graph has an Eulerian trail if and only if it has exactly two vertices of odd degree. The trail begins and ends these two vertices.
A graph G is nonplanar if and only if it contains a “copy” of K 3 , 3 or K 5 as a subgraph.
For any connected planar graph G embedded in the plane with V vertices, E edges, and F faces, it must be the case that
V + F = E + 2.
Recall that a graph consists of two sets: a set of vertices and a set of edges.
While we often represent graphs visually, we can distinguish between a graph and a plot in the following way: A graph stores information and connections between information while a plot provides a visual representation of the information stored in a graph.
Given that graphs are important, we now examine how we can represent graphs using a computer and see how one computer package handles graphs.
Let G be a graph with n vertices. We can use an n × n matrix to store the graph. Let
gij =
1 if vertex i is adjacent to vertex j 0 if vertex i is not adjacent to vertex j
For example, the graph on the left has the adjacency matrix on the right.
Note: matrix is symmetric
The adjacency matrix for a directed graph will not be symmetric unless the directed graph itself is symmetric.
Consider K 30 , the complete graph with 30 vertices. This graph has C (30, 2) = 435 edges since every vertex is connected to every other vertex. The adjacency matrix will have 1’s in every non-diagonal position (why not on the diagonals?). We say the 30 × 30 adjacency matrix is dense or full since most of the entries are non-zero.
Now consider C 30 , a cycle (or ring) graph with 30 vertices. Each vertex is connected to two other vertices to form a single ring or cycle. This means there are only 30 edges. So, while the adjacency matrix will be 30 × 30, only 60 entries in it will be non-zero. In this case we say the graph and the adjacency matrix are sparse.
Note that in the case of undirected graphs we really only need the upper-right triangle or the lower-left triangle (about half) of the adjacency matrix to store the information in the graph.
In the case of directed graphs, we need the full matrix.
In either case, if the graph is sparse, there are more efficient ways to store the graph. One of these is to maintain an edge list.
(^1) Edge List v1: For each vertex, store a list of vertices that the vertex is adjacent to. (^2) Edge List v2: Store all edges in the graph as a list of ordered pairs.
Adjacency Matrix
Edge List v
Edge List v
Which version we choose to use is largely dependent on how we need to access the information.