0% found this document useful (0 votes)
77 views

Graphs and Networks: Vertices, Edges

This document discusses basic concepts in graph theory including vertices, edges, subgraphs, isomorphic graphs, adjacency matrices, degree of vertices, trails, paths, and cycles. It provides examples and definitions of these terms. Key points covered include: - A graph consists of vertices connected by edges - Subgraphs are graphs within a larger graph - Isomorphic graphs have the same structure when vertices are relabeled - Adjacency matrices represent graphs with 1s indicating edges between vertices - Degree is the number of edges at a vertex, determining if it is even or odd - Trails allow repeated vertices, paths do not, and cycles connect the start/end vertex

Uploaded by

Nick Thompson
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
77 views

Graphs and Networks: Vertices, Edges

This document discusses basic concepts in graph theory including vertices, edges, subgraphs, isomorphic graphs, adjacency matrices, degree of vertices, trails, paths, and cycles. It provides examples and definitions of these terms. Key points covered include: - A graph consists of vertices connected by edges - Subgraphs are graphs within a larger graph - Isomorphic graphs have the same structure when vertices are relabeled - Adjacency matrices represent graphs with 1s indicating edges between vertices - Degree is the number of edges at a vertex, determining if it is even or odd - Trails allow repeated vertices, paths do not, and cycles connect the start/end vertex

Uploaded by

Nick Thompson
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

Graphs and networks

Vertices, edges

In graph theory, the term 'graph' means a set of vertices, or nodes, connected by edges. or arcs.

Graphs may have loops that connect a vertex to itself. They rnay also have multiple edges joining any two vertices.
A loop

A graph is made up of subgraphs. A subgraph is a graph in its own right and may consist of a vertex, two vertices and an edge, or many vertices and edges.
u

y
Multiple edges

Some subgraphs of the graph on the right are given below.

The actual positions of the vertices and the shapes of the edges do not matter.

! !

Two graphs are equivalent, or isomorphic, if one can be transformed into the other without breaking any edges.

You will not be examined on isomorphic graphs but it is useful to know the terminology.

Example 2.1 Show that these two graphs are equivalent.

We need to topologically transform the graphs so that they look the same.
Step I : Drop P down to ? i t betweerr C). R, S and 7: We could relabel the second graph so that P becomes C, Q becomes A, R becomes B. S becomes E. and T becomes D

Step 2 : Pull edge QT to the top to make the two graphs look the kame.

The two graphs are the same. C and P are connected to each of the other four vertices, and every other vertex is connected to three other vertices.

Directed and undirected graphs; connectedness; bipartite graphs.

If a graph does not contajn loops or multiple edges, it is called a simple graph.

A connected graph is one where it is possible to reach any vertex from any other vertex, directly or indirectly.

This graph is connected.

This graph is unconnected.

A graph that is not connected can be split into two or more disconnected subgraphs. A graph that is both simple and connected is called a simply connected graph.

In a directed graph, or digraph, some of the edges have a specific direction assigned (like a one-way street). A directed edge will be marked with an arrow to show its direction.

An undirected graph has no arrows. It can be represented as a directed graph as follows.

& 6 ~ ~ % ~ i r -+

]I'R~~Is

A planar graph is one that can be drawn so that the edges do not cross over one another.

The graph on the left is planar becallre it can be transformed and redrawn as shown in the graph on the right.
A
C

---- - You will not be examined on planar graphs hut it is useful to know the tern~inology

The vertices of a bipartite graph can be split into two sets so that each edge joins a vertex from one set to a vertex from the other set: no edge joins two vertices which are in the same set. For example:

A complete graph of n vertices, K,,, is a simply connected graph where each vertex is connected to every other vertex by only one edge.
I

i
I

A complete bipartite graph K,,, ,, is a simple bipartite graph with two sets of vertices, one of size rn and the other of size n, in which every pair of vertices with one from each set are joined by an edge.

I/

Example 2.2 Draw the graphs K, and Ki.


Step 1 : Mark l ' i ~ vertice ~~r for K, and fi\.e for K,, and connect e\ery vertex to e\i'r) 0tl1cr \CS1CX. Here K, is shown ;IS a planar graph. with no edges crossing. but this is not necessary. It is not possible to draw K , as a planar graph.

Kg

Alternative for KJ

Example 2.3 Draw the graph of K,,.


Step I: Mark three vertices in a vertical line and I'OLII.
vcrrice5 in another vcrtical line and connect every vertex in o n e set to every vertex in the other set.

SKILLS CHECK

2A: Graphs

1 Draw a diagram to show a connected graph with four vertices and five edges

2 For each of the fc>llowing:


i give the number of vertices ii give the number of edges iii say whether or not the graph is connected.

3 The graph K, has many subgraphs, several of which are isomorphic to one another.
There are 10 non-isomorphic subgraphs (8 proper subgraphs. the subgraph with n o edges and the subgraph that is the whole of K,). Draw diagrams to illustrate the eight different proper subgraph types.

a By relabelling the second graph, show that the two graphs are isonlorphic.
b By redrawing the first graph, show that the graphs are planar.

5 a Drau the graph K z ,.


b Delete any one edge from the graph K , and show that the resulting graph is planar.

6 a How many vertices and how many edges does the graph K,, have'?
b How many vertices and hou many edges does the graph K,, ,, have'?

c How many vertices and how many edges does the graph K,,, ,, have?
7 Draw an example of an undirected graph that has 4 vertices and 8 edges. Explain why there is n o simple graph that fit, this description.

8 Edges are removed from the graph k'j to make a set of subgraphs that are not connected to one
another.

a What is the maximum number of edges that remain if there are two subgraphs, one connecting
two vertices and one connecting three vertices?

b What is the maximum number of edges that remain if there are two subgraphs, one connecting four vertices and the other consisting of a single vertex'?

c What is the maximum number of edges that remain if there are three subgraphs?

Adjacency matrices

Instead of a diagram, we may be given the information about which vertices are connected in an adjacency matrix. In an adjacency matrix: an entry of '-' or '0' means there is no edge directly joining the two vertices an entry of ' 1' means that there is one edge that directly joins the two vertices an entry of '2' means that there are two different edges that directly join the two vertices. and so on. Graphs with identical adjacency matrices are isomorphic.
Transforming graphs into matrices allows u s to store the infor,nation in a computer,

Example 2.4 Represent the following graphs as adjacency matrices and hence show that they are isomorphic.

To
Step I : Make a tablc with
rows and columns labcllccl

Ti?
D E

A A

with thc vertex labels.

From

From

D
E

Step 2 : For each \.crtex recol.d the rlumher ol'cdfes Ieaciing to each ol' the othcr \,e~.tices.

AIBIC A From C I

D l 1 l -

t
because you can go either way around the loop.

l 1
-

l l

B 1 - 1 - - 1 1 1 1 -

From

D
E
Step .?: Keorclcr the row5 and columns o f rhc wcond ~ n a t r i x that it lool\s the so samc ;I\ !he firnt. This shows t h ~ i thc t h o gl.ilphs t Lue thc samc.

1 2 1 1

From

e sum across the rows o the tables we can see that A. B, E, (2. R, S and T have three edges coming from them and, C and Peach have 4 edges and 11 and T have 5 edges.

SKILLS CHECK

2B: Adjacency matrices

1 Draw the graph represented by the adjacency matrix. A B C D

2 A graph G is shown on the right.


Write down the adjacency matrix for this graph

3 Draw the directed graph represented


by this adjacency matrix.

A B C

4 Write down the adjacency matrix for the graph shown

5 Write down the adjacency matrix for the graph K,.

6 Draw the graph represented by this adjacency matrix.


A 0 2 1 2 -I B 2 0 1 0 l C 1 1 2 1 l D 2 0 1 0 1 E 1 1 1 1 0

7 Write down the adjacency matrix for the graph K2,

,.
J K L M

8 The adjacency matrices for three graphs are given below.


A B C D E F G

a By first considering the number of edges that connect to each


vertex, show whether or not the graph represented by the first matrix is isomorphic to the graph represented by the second matrix.

b Deduce whether either of the first two graphs is isomorphic to the third.

Degree of a vertex, odd and even vertices; paths, cycles

The degree of a vertex is the number of edges meeting at that vertex If the number of edges is even, the vertex is called an even vertex. If the number of edges is odd, the vertex is called an odd vertex.
A trail is a sequence of edges such that the end vertex of one edge is the start vertex of the next.

A path is a trail with the additional restriction that no vertex is passed through more than once.
A cycle is a path to which an extra edge has been added to join the final vertex back to the initial vertex.

through twice but an edge cannot be used twice.

Travelling Salesperson problem in Chapter 7, the word tour is used to describe a closed trail.

Example 2.5 For the graph shown on the right, give an example of:

a a trail

b a path

a a cycle.

Step 1 : 1,ook fol- a secluencc ofcdyes whcrc nonc of the edgcs are repeated. Step 2 : I.ook fol- ;I lr~rii with no repeulccl vertices. Step -3: Looh for a path ancl

a An example of a trail is A - B - D F - B - C.
-

Vertex B I \ pa\\ed through Im8lc.e none of the edges are but repeated.

b An example of a path is A - B - D - F.
c An example of a cycle is A - B
-

D -F-A.

A trail or 3 path with just one edge is too simple to be u s e f ~ ~

add an edge to makc the cnd point thc same as the start.

SKILLS CHECK

2C: Degree of a vertex; trails, paths and cycles


Questions 1,2 and 3 refer to the graph shown.

1 a Write down the degree of each vertex of the graph.


b List the odd vertices.

c Find the sum of the degrees of all the vertices and the number
of edges in the graph.

2 For the graph above, write down an example of

a a trail through four vertices. that is not also a path;


b n path through four vertices:

c a path through all the vertices.


3 For the graph above, explain why each of the following is not a cycle.

a A-B-C-D-E-F-G-A
b A-B-C-D-E-G-F
c A-B-C-D-E-C-A

4 Draw an example of a connected graph with four vertices on which there are no cycles.

5 Draw a graph that has two vertices of degree 3 and two vertices of degree 1
6 a Draw the graph represented by the following adjacency matrix.

b Write down an example of a path that passes through all four vertices on the graph.

c Write down an example of a cycle that passes through all four vertices on the graph.

7 a Show that it is not possible to have an undirected graph with four vertices, one of degree 2 and three of degree 3.

b Draw a directed graph that has four vertices. one of degree 2 and three of degree 3.

8 Draw a graph that has four vertices on which there is a trail through all four vertices but there is no
path through all four vertices.

Eulerian trails and Ham~ltonian cycles

An Eulerian graph has a closed trail that contains e;iery edge exactly once. A semi-Eulerian graph has a trail that is not closed but which contains every edge exactly once.

This graph ia Eulerian.

This graph ia not.

The easiest way to check whether a graph is Eulerian, semi-Eulerian or neither is to count the number of vertices of odd degree. An Eulerian graph has no vertices of odd degree and a semi-Eulel-ian graph has exactly two vertices of odd degree.

Example 2.6 a Is the graph shown on the right Eulerian, seini-Eulerian or neither?
b What happens if an extra edge is added joining C to E'?
Step I Count the degrcc ol each \ ertex Step 2 : Count the number of odd vertices. Step.?: Arnend the clcgrces of the vertices.

a 4 , C and E each have degree 2; B. L) and F each have degree 4.


There are no odd vertices so the graph is Eulerian.

b With the extra edge, C and E become odd and the new graph is semi-Eulerian.
Any semi-Eulerian trail on this graph must have C and E as its initial and final vertices.

A Hamiltonian cycle is a cycle that passes through every vertex exactly once and returns to the starting point.

A Harniltonian cycle does not have to pass through every edge once.

This is a Hamiltonian cycle.

Harniltonian cycles are explored further in the Travelling Salesperson problem in Chapter 7.

SKILLS CHECK

2D: Eulerian trails and Hamiltonian cycles

1 A connected graph G has 17 vertices. State the minimum number of edges in a Hamiltonian cycle. 2 A connected graph G has six vertices. The degrees of the vertices are 2, 3,4. 5 , 6 and d.

a The graph is semi-Eulerian. What can you say about the value of d?
b The graph has 12 edges. What can you now say about the value of d ? 3 A graph G is shown on the right.
B E

a Write down an Eulerian trail, starting at vertex A .


b Write down a Harniltonian cycle starting at vertex A.
A

Questions 4 cirzd 5 are clhout the grnpll shoit-r~ the right. on

4 a Explain why A - B- C - D - A is not an Eulerian trail.

b Write down the degrees of the vertices and explain how this shows you that the graph is Eulerian.
c Write down an Eulerian trail for the graph.

5 a Explain why A - B - D - C -A

B - C- D -A is not a Hamiltonian cycle for the graph.

b Write down a I-Iamiltonian cycle for the graph. 6 a Is the graph K, Eulerian, semi-Eulerian or neither? Explain how you know. b What is the least number of edges that need to be removed from the graph K4 to make it Eulerian?
7 Ignoring the starting point and the direction of travel, how many distinct Hamiltonian cycles are there on the graph K,?

8 A simply connected Eulerian graph connects five vertices using six edges. Does a Harniltonian
cycle exist on such a graph?

Edge weights, distance matrices.

An edge weight is a numerical value given to an edge that may represent a distance, a journey time, a profit or a cost, for example. A network is a graph with weighted edges.

A network may be represented as a diagram or by using a distance matrix.


A

mD3
The diagram shows edge weights that represent the distance fro111 one vertex to another.
7
E

The diagram could equally represent the cost to get from one city to the next t h e matrix would then be called a cost matrix.

The distance matrix for the network represents the same infonnation as the diagram but in matrix form.

A 4 1 1 -

B 4 5 7

C 1 5 1 4

D 1 1 3

E 7 4 3 -

In a distance matrix the numbers represent the edge weights and 0 or '-' means that there is no edge directly joining these two vertices.

Example 2.7 Draw the network represented by this distance matrix:


A 3 2 1

B 3 4 2 -

C 4 5

D E 2 1 2 - 5 - 3 3 -

Step 2: I l r : ~ u ;in cdgc connec[ln; p:rlrs \r here a value i s \vri[tcn and write the ~ e i ; h t o n tlic cdfc.

SKILLS CHECK

2E: Representing networks

1 Draw the network represented by this distance matrix:


A B C D

2 Write down a distance matrix to represent the network on the right.

3 Draw the network represented by the distance matrix


To F G H F - 5 2 - 41 H 2 4 -

o m

4 Write down a distance matrix to represent the network below.

5 Calculate the length of an Eulerian trail on the network represented by the distance matrix
A B C D

6 Annie lives 2 miles from each of Bob, Carl and Dawn. Bob lives 1 mile from Dawn, and Carl lives 3
miles from Dawn.

a Write down a distance matrix to represent this information.


b What is the shortest distance between where Bob lives and where Carl lives. according to your matrix?
7 The Hamiltonian cycles in the network represented by the distance matrix below are all of the same

length. What is the value of x? A

B x

C 12

D 15

8 The matrix below shows the direct travel times. in minutes, between five underground stations.

The time for a journey is found by adding the direct travel times for each leg of the journey and then adding an extra 2 minutes for each station passed through, excluding the start and finish.

a What is the journey time for a passenger who gets on at P and travels to T via Q?
b What is the journey time for the quickest Hamiltonian cycle on the network?

Trees.

A tree is a single, simple graph on which there are no cycles. The following are all examples of trees.

Any graph has a spanning tree (a subgraph that connects all the vertices on the original graph, and is alqo a tree). A spanning tree on a graph with 11 vertices will have 11 - 1 edges.

Original graph

One spanning tree

Another spanning tree

A minimum spanning tree is a spanning tree of minimum total weight on a network. It is a spanning tree for which the sum of the edge weights is as small as possible. A minimum spanning tree can also be called a minimum connector

SKILLS CHECK

2F: Trees

1 A connected graph G has 11 vertices. State the number of edges on a spanning tree on G.

2 A network has four vertices and four edges. The edge weights are 2. 5, 10 and 20. The minimum spanning tree has weight 32. Draw a diagram to show a network that fits this description.

3 There are only three non-isomorphic spanning trees that can be drawn on five vertices.
Draw diagrams to show all three types.

4 a A spanning tree includes a vertex of order 5, explain why it must have at least five vertices of order 1.

b Draw a spanning tree that includes a vertex of order 5 and has exactly six vertices of order 1 .

5 Explain why a spanning tree cannot have vertices of orders 1. 1 , 1 . 1 , 2.3.

6 A network is represented by the matrix below. The minimum spanning tree has weight 35. What can
you conclude about the value of s? A B C D

7 a Explain why a trec can never be an Eulerian graph.

b What is the length of the shorieht closed trail through every vertex of a tree?
8 A tree has vertices of degree 1, 1, 1, 2 , 3 . n.

a How many vertices does the tree have?


b How many edges does the tree have?

c Calculate the value of n.

1 a A connected graph has four vertices. State the number of edges in t11e graph's
minimum spanning tree.

b A graph has n vertices. 'l'he graph is complete, i.e. each vertex is joincd to every other vertex by exactly onc cdge. i Slate the number of cdges in the graph's minimum \panning tree. ii Deterrninc thc number of Hamiltonian cycle\ in the graph.
c A connected graph has Sour vet-tices and has arc lengths of

4,4.5, 5, 6.5, 7, 8 and 9 units.


The leneth of its minimum spanning tree is 17 units. Draw a sketch to show a possible graph.
[AQA(A) June 200

2 'The following question refers to the thrcc graphs: Graph 1, Graph 2 and Graph 3.
Graph 1 Graph 2 Graph 3

For each of the graphs explain whether or not the graph is Eulerian.
3 A _graph G has five vertices.

[AQA(A) Jan 30i

a i Given that G is connected, state thc number of arcs on a minimum spanning tree. ii Given that G is Eulerian with all vertices having the same degree d, state the minimum value of d. iii Given that G has a Hamiltonian cycle, state the number of edges in wch a cycle. b Given that G has all the properties mentioned in part a, draw a possible graph G.
[AQA(A) Jan 20:

4 a Draw a graph representing this adjacency matrix.

b Draw a spanning tree for your ~ r a p h .

c Construct an adjacency matrix that your spanning tree represents.


5 a Draw a network representing this distance matrix.

b Construct an Eulerian trail for your graph, starting at vertex A .

c Calculate the length of your Eulerian trail.


6 A simply connected graph has six vertices and nine edges.

a What is the suln of the degrees of the vertices?


b Explain why such a graph cannot have three vertices of degree 5 .
c Draw an example of a simply connected Eulerian graph with six vertices and nine edges.

7 A graph G is shown.

I53
A B C - 1 1 1 - 1 - 1 1 1 - 1 -

a Explain why U-X- V- Y- W - Z is not a trail on G.


b Explainwhy U - V - W - Z - U - X - Y i s n o t a p a t h o n G .

c Explain why U - Z- Y - X- V- U is not a Ha~niltonian cycle on G.


8 A graph has the ad.jacency matrix
D E 1 1 1 I - 1 I -

a Draw a diagram of a graph that could be represented by this adjacency matrix.


b List a Ha~niltonian cycle on this graph.

c For this graph. calculate the number of spanning trees that use neither of the edges AC and AD.
explaining your reasoning.

You might also like