Disc Lec6 - Graphs
Disc Lec6 - Graphs
Disc Lec6 - Graphs
AND INFORMATICS
Discrete Structure
Graphs
1
Graphs
Graph Terminology
Shortest-Path Problems
1. Graphs and Graph
Models
Web browser.
Communication Networks (1)
The Hollywood graph is a huge graph with more than 2.9 million
vertices (as of early 2018).
Social Networks
Collaboration Graphs
In an academic collaboration graph, vertices represent people
(perhaps restricted to members of a certain academic
community), and edges link two people if they have jointly
published a paper.
When we care only whether there has been a call connecting two
telephone numbers
Biological Networks
• Many aspects of the biological
sciences can be modeled using
graphs.
• Protein Interaction Graphs
– A protein interaction in a
living cell occurs when two or
more proteins in that cell bind
to perform a biological
function. Because protein
interactions are crucial for
most biological functions,
Tournaments (1)
Round-Robin Tournaments is a tournament where each
team plays every other team exactly once and no ties
(draws) are allowed
We see that Team 1 is
undefeated in this
tournament, and Team 3 is
winless
Tournaments (2)
Single-Elimination Tournaments is a tournament where
each contestant is eliminated after one loss
Semantic Networks (1)
A computer network
Loops
Definition:
Edges that connect a vertex to itself are called loops.
edge(u,v)
u v
The Neighborhood of a Vertex
Definition:
The set of all neighbors of a vertex v of G = (V, E), denoted by
N(v), is called the neighborhood of v. If A is a subset of V, we
denote by N(A) the set of all vertices in G that are adjacent
to at least one vertex in A. So, N(A) = ⋃v∈A N(v).
N(a) = {b, f }
N(b) = {a, c, e, f }
N(c) = {b, d, e, f }
N(d) = {c}
N(e) = {b, c, f }
N( f) = {a, b, c, e}
N(g) = ∅.
Degree of a vertex
Definition 3:
The degree of a vertex in an undirected graph is the number
of edges incident with it, except that a loop at a vertex
contributes twice to the degree of that vertex.
The degree of the vertex v is denoted by deg(v).
deg(a) = 2
deg(b) = 4
deg(c) = 4
deg(d) = 1
deg(e) = 3
deg(f ) = 4
deg(g) = 0.
In-degree and Out-degree of
a Vertex (1)
Definition:
In a graph with directed edges the in-degree of a vertex v,
denoted by deg−(v), is the number of edges with v as their
terminal vertex.
The out-degree of v, denoted by deg+(v), is the number of
edges with v as their initial vertex.
(Note that a loop at a vertex contributes 1 to both the in-degree
and the out-degree of this vertex.).
In-degree and Out-degree
of a Vertex (2)
Example :
Find the in-degree and out-degree of each vertex in the graph G
with directed edges shown in the following Figure?
Number of vertices = 6
Number of edges = 12
deg−(a) = 2 deg+(a) = 4
deg−(b) = 2 deg+(b) = 1
deg−(c) = 3 deg+(c) = 2
deg−(d) = 2 deg+(d) = 2
deg−(e) = 3 deg+(e) = 3
deg−(f) = 0 deg+(f) = 0
In-degree and Out-degree of
a Vertex (3)
Theorem :
Let G = (V, E) be a graph with directed edges. Then
Directed graphs
Definition:
A directed graph (or digraph) (V, E) consists of a nonempty
set of vertices V and a set of directed edges (or arcs) E. Each
directed edge is associated with an ordered pair of vertices.
The directed edge associated with the ordered pair (u, v) is
said to start at u and end at v.
Mixed Graph
Directed Multigraphs
Directed graphs that may have multiple directed edges
from a vertex to a second (possibly the same) vertex are
used to model such networks.