CH 1 - Introduction
CH 1 - Introduction
Chapter I
Introduction
For example,
V = {1, 2, 3, 4, 5}
E = { (1,2), (1,3), (1,4), (2,3), (3,5), (4,5) }
1 3
Vertex
Edge 2 (Node)
Computer Networks
Computer
Road Map
City
12/07/2023 Prepared by Dr. Zakir H. Ahmed 5
Undirected Graph
assigned weights. 4
50
5
Directed Edges 2
Determine whether
the graph shown
has directed or
undirected edges,
whether it has
multiple edges, and
whether it has one
or more loops. Use
your answers to
determine the type
of graph in Table 1
this graph is.
12/07/2023 Prepared by Dr. Zakir H. Ahmed 9
Solution
3. Simple graph
5. Pseudograph
7. Directed graph
9. Directed multigraph
A graph with both directed and undirected edges is called a mixed graph.
4
the nodes v1 and v2 are adjacent.
5
An edge e1 = (v1, v2) is incident to vertices v1 and v2.
Find the number of vertices, the number of edges, and the degree of each vertex in the given
undirected graph. Identify all isolated and pendant vertices.
d is isolated.
3. |V| = 9; |E| = 12; d(a) = 3, d(b) = 2, d(c) =4, d(d) = 0, d(e) = 6, d(f) = 0; d(g) = 4; d(h)
2 3
on n vertices, Kn, is
the simple graph 3 4
4 5
consists of n vertices
2 3
v1, v2, ….., vn, and 3 4
n edges (v1, v2), (v2, v3), … , (vn-1, vn), and (vn, v1).
12/07/2023 Prepared by Dr. Zakir H. Ahmed 23
Graph Representation: Adjacency Matrix
3 1 0 1 1 1 0 2
1
2 1 0 1 0 0 1 2 3
2
4
3 1 1 0 0 1 1 0 1 0
5 4 1 0 0 0 1 2 0 0 1
5 0 0 1 1 0 3 1 1 0
Example:- Use the following adjacency matrix to represent the pseudograph using the
ordering of vertices a, b, c, d
following graph
vertices a, b, c, d
12/07/2023 Prepared by Dr. Zakir H. Ahmed 27
Graph Representation: Adjacency List
2 1 5
3
1 5
4
4
5
5
4 2 5
2 4
1
3 5
2
9 2 5
3 1
e3 e1 v2 e4 v2 1 0 0 1 0 0
e5
v4 v3 0 1 0 1 1 0
e6 v5 v4 0 0 1 0 0 1
v5 0 0 0 0 1 1