0% found this document useful (0 votes)
13 views29 pages

Lecture-35 Teacher

lecture 35
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views29 pages

Lecture-35 Teacher

lecture 35
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 29

Chapter 10

Graphs
Chapter Summary

 Graphs and Graph Models


 Graph Terminology and Special Types of Graphs
 Representing Graphs and Graph Isomorphism
 Connectivity
 Euler and Hamiltonian Graphs
 Shortest-Path Problems
 Planar Graphs
 Graph Coloring
Section 10.1

Graphs and Graph Models


Section Summary

 Introduction to Graphs
 Graph Taxonomy
 Graph Models
Graphs
Definition:
– A graph G = (V, E) consists of a nonempty set V of vertices (or nodes) and a set E
of edges.
– Each edge has either one or two vertices associated with it, called its endpoints.
– An edge is said to connect its endpoints.
a b
Example: This is a graph with four vertices and five edges.

d c

Remarks:
– The graphs we study here are unrelated to graphs of functions studied in Chapter 2.
– We have a lot of freedom when we draw a picture of a graph. All that matters is the connections
made by the edges, not the particular geometry depicted. For example, the lengths of edges,
whether edges cross, how vertices are depicted, and so on, do not matter
– A graph with an infinite vertex set is called an infinite graph. A graph with a finite vertex set is
called a finite graph. We (following the text) restrict our attention to finite graphs.
Some Terminology

 In a simple graph each edge connects two different


vertices and no two edges connect the same pair of vertices.
Some Terminology

 Multigraphs may have multiple edges connecting the same


two vertices.
– When m different edges connect the vertices u and v, we say
that {u,v} is an edge of multiplicity m.
 An edge that connects a vertex to itself is called a loop.
 A pseudograph may include loops, as well as multiple
edges connecting the same pair of vertices.
Some Terminology

Example: This pseudograph has both multiple edges and a loop.

a b

c
Remark: There is no standard terminology for graph theory. So, it is crucial that you
understand the terminology being used whenever you read material about graphs.
Directed Graphs

Definition:
– An directed graph (or digraph) G = (V, E) consists of a nonempty set V of
vertices (or nodes) and a set E of directed edges (or arcs).
– Each 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.

Remark:
– Graphs where the end points of an edge are not ordered are said to
be undirected graphs.
Some Terminology

 A simple directed graph has no loops and no multiple edges.

Example: This is a directed graph with


three vertices and four edges.

a b

c
Some Terminology

 A directed multigraph may have multiple directed edges.


When there are m directed edges from the vertex u to the
vertex v, we say that (u,v) is an edge of multiplicity m.

Example: In this directed multigraph the multiplicity of (a,b) is 1


and the multiplicity of (b,c) is 2.

a b

c
Graph Models: Computer
Networks
 We illustrate this process using graph models of different types of
computer networks.
 In all these graph models,
– the vertices represent data centers and
– the edges represent communication links.
– all communications links work in both directions.

Simple graph
Graph Models: Computer
Networks
• To model a computer network where
we care about the number of links
between data centers, we use a
multigraph.

• To model a computer network with


diagnostic links at data centers, we
use a pseudograph, as loops are
needed.

• To model a network with multiple one-


way links, we use a directed
multigraph. Note that we could use a
directed graph without multiple edges
if we only care whether there is at least
one link from a data center to another
data center.
Graph Terminology: Summary

 To understand the structure of a graph and to build a graph model, we


ask these questions:
• Are the edges of the graph undirected or directed (or both)?
• If the edges are undirected, are multiple edges present that
connect the same pair of vertices? If the edges are directed, are
multiple directed edges present?
• Are loops present?
Graph Models

 Graphs are used in a wide variety of models. :


– Social networks
– Communications networks
– Information networks
– Software design
– Transportation networks
– Biological networks
 It’s a challenge to find a subject to which graph theory has not yet
been applied. Can you find an area without applications of graph
theory?
Graph Models: Social Networks

 Graphs can be used to model social structures based on different


kinds of relationships between people or groups.
 In a social network, vertices represent individuals or organizations
and edges represent relationships between them.
 Useful graph models of social networks include:
– An Acquaintanceship and friendship graphs - undirected
graphs whether two people know each other, that is, whether they
are acquainted, or whether they are friends
(in the real world, on Facebook, or in a particular virtual world, and
so on.)
– collaboration graphs - undirected graphs where two people are
connected if they collaborate in a specific way
– influence graphs - directed graphs where there is an edge from
one person to another if the first person can influence the second
person
Graph Models: Social Networks

Example: A Acquaintanceship and friendship graph where two


people are connected if they are Facebook friends.

Example: An influence graph


Graph Models: Social Networks

 The Hollywood graph models the collaboration of actors in films.


– We represent actors by vertices and we connect two vertices if
the actors they represent have appeared in the same movie.

 An academic collaboration graph models the collaboration of


researchers who have jointly written a paper in a particular subject.
– We represent researchers in a particular academic discipline
using vertices.
– We connect the vertices representing two researchers in this
discipline if they are coauthors of a paper.
Graph Models: Communication Networks

 Call Graphs
• Graphs can be used to model telephone calls made in a network,
such as a long distance telephone network.
Graph Models: Information Networks

 Graphs can be used to model different types of networks that link


different types of information.
 In a web graph,
– web pages are represented by vertices and links are represented
by directed edges.
– A web graph models the web at a particular time.

 In a citation network:
– Research papers in a particular discipline are represented by
vertices.
– When a paper cites a second paper as a reference, there is an
edge from the vertex representing this paper to the vertex
representing the second paper.
Graph Models: Software Design Applications

 Graph models are useful tools in the design of software.


 Module Dependency Graphs,
– provides a useful tool for understanding how different modules of
a program interact.
– Each module is represented by a vertex.
– There is a directed edge from a module to a second module
if the second module depends on the first.
Graph Models: Software Design Applications

 Precedence Graphs and Concurrent Processing,


– Computer programs can be executed more rapidly by executing
certain statements concurrently.
– The dependence of statements on previous statements can be
represented by a directed graph.
– Each statement is represented by a vertex, and there is an edge
from one statement to a second statement if the second
statement cannot be executed before the first statement.
Graph Models: Transportation Networks

 Graph models are extensively used in the study of transportation


networks.
 Airline networks can be modeled using directed multigraphs where
– airports are represented by vertices
– each flight is represented by a directed edge from the vertex
representing the departure airport to the vertex representing the
destination airport
 Road networks can be modeled using graphs where
– vertices represent intersections and edges represent roads.
– undirected edges represent two-way roads and directed
edges represent one-way roads.
Graph Models: Biological Networks

 Graph models are used extensively in many areas of the biological


science. We will describe two such models-
– one to ecology and
– the other to molecular biology.
Graph Models: Biological Networks

 Niche overlap graphs model competition between species in


an ecosystem
– Vertices represent species and
– an edge connects two vertices when they represent species
who compete for food resources.
Graph Models: Biological Networks

 In a protein interaction graph,


– vertices represent proteins and
– vertices are connected by an edge if the proteins they
represent interact.
 Protein interaction graphs are often split into smaller graphs,
called modules, which represent the interactions between
proteins involved in a particular function.
Graph Models: Tournaments

 Round-Robin Tournaments ,
– Such tournaments can be modeled using directed graphs
where each team is represented by a vertex.
– Note that (a, b) is an edge if team a beats team b.
Graph Models: Tournaments

 Single-Elimination Tournaments,
– A tournament where each contestant is eliminated after one
loss is called a single-elimination tournament.
Query???

1  2  3  4.... xy ( x  y ) ?

  1
 x 1 x ?  x 1
?
x

 x (  | x ) ? xy ( x  y ) ?

 1
1  2  3  4.... ?
1  1  1  1  1......... ?
 x 1
x
?

You might also like