Undirected graphs
This presentation is the property of its rightful owner.
Sponsored Links
1 / 9

Undirected graphs PowerPoint PPT Presentation

  • Uploaded on
  • Presentation posted in: General

Undirected graphs.

Download Presentation

Undirected graphs

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript

Undirected graphs

Undirected graphs

The diagram above represents cities (A, B, C, D, E, F) which are connected by roads. The diagram is called a network because the cities are joined and we can get from one to the other by roads.Other examples of networks are the computers at our schooll or teams versing each other.The graph is also an undirected graph since there is no specific direction between the cities.

The pointsA,B,C,D,EandFare called thevertices (circles)of the graph and the linesconnecting the vertices are callededges (lines).

The verticesAandBof a graph areadjacentvertices if they are joined by an edge.

The graph can be represented by amatrix.The matrixshown above represents the graph and is called adjacency matrix.The entries on the adjacency matrix,represent the number of edges joining two vertices.

Undirected graphs

This graph is said to havemultiple edgesas there are two edges joiningAandD.Chas one edge, which linksCto itself. This edge is calledaloop. A loop is recorded as two edges in an adjacency matrix.The adjacency matrix appear as shown below.

Abipartite graphis a graph whose set of vertices can be split into two subsetsXandYinsuch a way that each edge of the graph joins a vertex inXand a vertex inY.

Example:Construct the adjacency matrix corresponding to the graphshown, which represents three houses,A,BandC,connected to three utility outlets, gas (G), water (W)and electricity (E).

Undirected graphs

The degree of a vertex is the number of edges coming of it.

Example: For the graph on the right:

degA= 3

degB = 2

degC = 2

degD = 5B

Asimple graphis a graph with no loops or multiple edges. For a simple graph,the sum of the degrees of the graph is equal totwice the number of edges of the graph.

For the simple graph on the right

Sum(degrees) = deg(A) + deg(B) + deg(C) + deg(D) + deg(E) = 3 + 2 + 2 + 3 + 2 = 12

or Number of edges= 6

Sum(degrees) = 2×6 = 12

On the diagram on the right Eis anisolatedvertex (i.e. there are no edges

incident toE and deg(E) = 0)

Undirected graphs

A graph is said to bedegenerateif all its verticesare isolated.

Apathis a sequence of edges that join the vertices.

For example ABGE or ABCG are paths for the diagram on the right.Acircuitis a paththat starts and finishes at the same vertex. For example BGCB is a circuit.

Asubgraphof a graph consists of selected edges and vertices of the graph with the same

links as the original graph. For example the

graph ABF is a subgraph of ABCDEF.

A connected graph is a graph in which it is possible for one vertex to reach all other vertices by following edges. A minimum of n-1 edges is needed for a graph with n vertices to be connected

Undirected graphs

A Planar graph is a graph that has no edges which cross. A graph that has edges that cross can be redrawn in such a way that these edges do not cross. When we do that we need to maintain the same degree of all the vertices. However that cannot always be done. Those graphs are called non-planar graphs. For the following graph the edges CE and AD are crossing each other.If we strech one of these outside then they wan’t cross and proves that the graph is plannar.

Not all graphs are planar. The graph below cannot be redrawnso that the edges have no intersection points.

For a connected plannar the Euler’s formula applies:

v - e + f =2

v = vertices

e = edges

f = faces

Undirected graphs

Example: Verify Euler’s formula for the graph shown.

e = 7

v = 5

f = 4

v - e + f = 2

5 - 7 + 4 = 2

Example: A connected planar graph has 6 vertices and 8 edges. How many faces does the graph have?Draw a connected planar graph with 6 vertices and 8 edges.

Solution: Euler's formula:

v − e + f = 2

v = 6 and e = 9

6 − 9 + f = 2

−3 + f = 2

f = 5

Undirected graphs

Acomplete graphis a graph with edges connecting all pairs of vertices.

To find the number of edges Kn , where n is the number of vertices we are using the following formula:

Kn = n(n-1)


K4has4(4 − 1) = 6 edges


K5has5(5 − 1) = 10 edges


The complete graph below could be drawn for six peopleat a party. Each edge indicates that aconversation took place. The adjacencymatrix has 1s in all positions except themain diagonal.

Undirected graphs

Euler and Hamilton paths

A path that includes every edge just once is called anEuler path.


a To have an Euler path the graph must have two vertices of odd degree and the the rest of even degree.

b For an Euler path we start at the odd degree vertex and we finish at the odd degree vertex.

AnEuler circuitis an Euler path that starts and finishes at the same vertex.

Condition: All vertices have an even degree.

Example:aExplain why the graph below has an Euler pathbetweenBandC.

bList one possible Euler path (there are several)betweenBandC.

Answer: a B and C are odd vertices.

The remaining vertices are even.

b B → A → E → D → B → C → D → C .

Undirected graphs

Example:aExplain why the graph shown below has an Euler circuit.

bList an Euler circuit for this graph.

Answer: a The graph has only even vertices.

b An Euler circuit is C → D → E → C → A → B → C

A path that includes every vetrex just once is called a Hamilton path.

AHamilton circuitis a Hamilton path that starts and finishes at the same vertex.

Example:List a Hamilton circuit for the graph shown.

Answer:A Hamilton circuit is

C→ B → A → E → F → G → H → D → C .

  • Login