+ All Categories
Home > Education > Basics of Graphs Theory

Basics of Graphs Theory

Date post: 17-Feb-2017
Category:
Upload: mariya-zaki
View: 13 times
Download: 0 times
Share this document with a friend
33
GRAPHS Mariya Bohra SYMCA K.K.Wagh Institute of Engineering and Education Research
Transcript
Page 1: Basics of Graphs Theory

GRAPHS

Mariya BohraSYMCAK.K.Wagh Institute of Engineering and Education Research

Page 2: Basics of Graphs Theory

What’s there in a Graph?

Graphs consist of points called vertices lines called edges

1. Edges connect two vertices.2. Edges only intersect at vertices.3. Edges joining a vertex to itself are called

loops.

Page 3: Basics of Graphs Theory

Example 1:

The following picture is a graph.List its vertices and edges.

A

E

D

C

B

Page 4: Basics of Graphs Theory

Why would you use Graph?

Graphs are a structure for describing relationships between objects.

The vertices denote the objects and the edges represent the relationship.

Page 5: Basics of Graphs Theory

Example 2:This is also a graph.

The vertices just

happen to have

people’s names.

Such a graph could

represent friendships

(or any kind of

relationship).

Ray Mary Suze

Jake Fanny Lulu

Luke

Page 6: Basics of Graphs Theory

GRAPH TERMINOLOGIES

Page 7: Basics of Graphs Theory

GRAPHS could be…• UNDIRECTED

Edges do not have a direction.

The edges indicate a two-way relationship.

Each edge can be traversed in both directions.

• DIRECTED

Edges have direction.The edges indicate

a one-way relationship.Each edge can only be

traversed in a single direction

Page 8: Basics of Graphs Theory

GRAPHS could be…• UNWEIGHTED

Edges have NO weight.

• WEIGHTED

Edges have a weight.

Page 9: Basics of Graphs Theory

GRAPHS could be…• CYCLIC

Graph contains cycles.

• ACYCLIC

 Graph contains no cycles

Page 10: Basics of Graphs Theory

A Complete Graph

• A complete graph is a graph where every vertex is adjacent to every other vertex.

• A complete graph on n vertices is denoted by Kn (or sometimes by K(n)).

Page 11: Basics of Graphs Theory

Example 3 :Which ones are complete graphs?

1. 2.

3. 4.

Page 12: Basics of Graphs Theory

The word ‘Adjacent’

• Adjacent Vertices are two vertices that are joined by an edge.

• Adjacent Edges are two edges that intersect at a vertex.

Page 13: Basics of Graphs Theory

Example 4: 1. List out the

pairs of adjacent vertices.

2. List out the pairs of adjacent edges.

Page 14: Basics of Graphs Theory

Degree of a Vertex

The degree of a vertex is the number of edges incident at that vertex, with loops counted twice.Degree of the Graph

The degree of a graph is the MAXIMUM degree its vertices.

Page 15: Basics of Graphs Theory

Example 5: 1. Find the degree

of each vertex .2. What is the

degree of the graph?

Page 16: Basics of Graphs Theory

Odd Degree and Even Degree

• An odd vertex is a vertex of odd degree.

• An even vertex is a vertex of even degree.

Page 17: Basics of Graphs Theory

Example 6: 1. Find the

vertices with• Odd degree• Even degree

Page 18: Basics of Graphs Theory

PATH

A path in a graph represents a way to get from an origin to a destination by traversing edges in the graph.

LENGTH

The length of a path is the number of edges that it uses.

Page 19: Basics of Graphs Theory

EXAMPLE 7: Path from Node 1 to Node 6.What is the length of the path in both the cases?

The red path is ((6,4), (4,3), (3,2), (2,5), (5,1)); it is a path in G from node 6 to node 1

The blue path is ((6,4), (4,5), (5,1)); it is also a path in G from node 6 to node 1

Page 20: Basics of Graphs Theory

EXAMPLE 8:1. Find the path

from Node 6 to Node 1.

2. Find the path from Node1 to Node 6.

Page 21: Basics of Graphs Theory

CONNECTED GRAPH

A graph is connected if any two vertices can be joined by a path. If this is not possible then the graph is disconnected.

A bridge is an edge in a connected graph whose removal makes it disconnected.

Page 22: Basics of Graphs Theory

EXAMPLE 9:Is the graph connected?If yes, find the bridge.

Page 23: Basics of Graphs Theory

EXAMPLE 10:Is the graph connected?

Page 24: Basics of Graphs Theory

EXAMPLE 11:Is the graph connected?

Page 25: Basics of Graphs Theory

Representation of Graphs

1.Adjacency Matrix Representation2.Adjacency List Representation

Page 26: Basics of Graphs Theory

Adjacency Matrix Representation• A graph may be represented by a two

dimensional adjacency matrix.• If G has n = |V| vertices, let M be an n by n matrix whose entries are defined by

Page 27: Basics of Graphs Theory

EXAMPLE 12: Find the Adjacency Matrix Representation of the given graph

Page 28: Basics of Graphs Theory

SOLUTION: Adjacency Matrix Representation of the given graph

Page 29: Basics of Graphs Theory

Adjacency List Representation

The adjacency list structure is simply a linked version of the adjacency table.

Page 30: Basics of Graphs Theory

EXAMPLE 13: Find the Adjacency List Representation of the given graph

Page 31: Basics of Graphs Theory

SOLUTION: Adjacency List Representation of the given graph

Page 32: Basics of Graphs Theory

Questions?

Page 33: Basics of Graphs Theory

THANK YOU


Recommended