4MTH312 Mock Exam Solns 2023
4MTH312 Mock Exam Solns 2023
4MTH312 Mock Exam Solns 2023
1
Mock Questions
1.1 Basic Concepts
a) List all the vertices and edges.
Vertices are the points in the graph, while edges are the lines connecting
the vertices.
Vertices: A, B, C, D, E, F
Edges: AB, BC, AD, BE, CF, DE, EF
b) Determine the degree of each vertex.
The degree of a vertex is the number of edges incident to it.
c) Identify all the paths from the top-left vertex (A) to the bottom-
right vertex (F).
A path is a sequence of vertices in which each adjacent pair of vertices in
the sequence is connected by an edge, and no vertex is repeated.
Paths from A to F :
(a) A → B → E → F
(b) A → D → E → F
(c) A → B → C → F
d) Is the graph cyclic or acyclic? Justify your answer.
A graph is cyclic if it has at least one cycle (a closed path in which the
first and last vertices are the same). In this graph, there are no cycles.
For example, there is no way to start at vertex A and return to A without
retracing an edge.
Answer: The graph is acyclic because it has no cycles.
2
e) Is the graph connected? Justify your answer.
A graph is connected if there is a path between every pair of vertices.
Looking at the graph, we can see that there is a path between any two
vertices.
Answer: The graph is connected because there is a path between every
pair of vertices.
2. Trees
2.1.
The primary difference is related to the weights of the edges. While any
connected graph can have multiple spanning trees, there’s only one (or
possibly more than one with the same total weight) minimum spanning
tree, which minimizes the total edge weight.
(d) Using Kruskal’s algorithm, find the minimum spanning tree for
the given weighted graph.
The minimum spanning tree (MST) for the given weighted graph, obtained
using Kruskal’s algorithm, consists of the following edges:
3
(a) 5 − 6 with weight 1
(b) 1 − 3 with weight 2
(c) 3 − 5 with weight 3
(d) 1 − 2 with weight 4
(e) 4 − 5 with weight 6
3. Graph Coloring
3.1.
4
Map Coloring: In cartography, the graph coloring problem repre-
sents the challenge of coloring a map in such a way that neighboring
regions have different colors.
The greedy algorithm does not necessarily produce the most optimal col-
oring, meaning the least number of colors for the entire graph. However,
it provides an upper bound for the chromatic number and is efficient in
its simplicity.
4. Planar Graphs
4.1.
5
(f) Connect vertex 1 to vertex 5 and vertex 3 to vertex 5, completing
the graph.
Since the graph can be redrawn without any of its edges crossing, apart
from where they meet at the vertices, it is a planar graph.
(c) State and explain Kuratowski’s theorem.
Kuratowski’s Theorem states that a graph is planar if and only if it
does not contain a subgraph that is a subdivision of K5 (the complete
graph on five vertices) or K3,3 (the complete bipartite graph on two sets
of three vertices).
Explanation: Both K5 and K3,3 are non-planar graphs. Kuratowski’s
theorem essentially tells us that any graph containing a subdivision of
these graphs (i.e., a graph obtained by inserting vertices into the middle
of edges) is also non-planar. It’s a key theorem in graph theory that
provides a criterion to check the planarity of a graph.
(d) Using Euler’s formula, verify if the given graph is planar.
For the second provided graph:
Number of vertices (V ) = 5
Number of edges (E) = 6
Calculated number of faces (F ) = 3
V −E+F =5−6+3=2
Since the formula holds true with the result being 2, this provides evi-
dence that the graph might be planar. However, as mentioned earlier,
this doesn’t serve as a conclusive proof. Given that the graph can be
visually inspected to be drawn without overlapping edges, it is indeed
planar.
The graph is planar based on Euler’s formula and visual inspection.
5. Network Flow
5.1.
6
which the flow originates and a sink (often denoted as t) where the flow
terminates. The goal in many network flow problems is to maximize the
amount of flow from the source to the sink without violating the capacity
constraints on the edges.
(b) Given a flow network, determine the maximum flow using the
Ford-Fulkerson algorithm.
The Ford-Fulkerson algorithm is a method used to compute the max-
imum flow in a flow network. The procedure is as follows:
After applying the Ford-Fulkerson algorithm to the given graph, the max-
imum flow from the source s to the sink t is found to be 14 units.
7
Remove the front vertex from the queue.
For each unvisited neighbor of the current vertex:
– Mark the neighbor as visited.
– Enqueue the neighbor.
(d) Continue until the queue is empty.
(b) How does BFS determine the shortest path in an unweighted
graph?
BFS can be used to find the shortest path in an unweighted graph because
it naturally explores vertices layer by layer, starting from the source vertex.
When BFS reaches a vertex, it is guaranteed that the path it took to reach
that vertex is the shortest possible path, as all paths of a shorter length
would have been explored in earlier iterations.
To find the shortest path using BFS:
(a) Modify the BFS algorithm to store the predecessor (or parent) of
each vertex.
(b) When a vertex is visited for the first time (i.e., dequeued), record the
vertex that led to its discovery as its predecessor.
(c) Once BFS completes, you can backtrack from the destination vertex
to the source using these predecessors to reconstruct the shortest
path.
(c) Given a graph, apply BFS to determine the shortest path be-
tween two specific vertices.
Applying BFS to the given graph, the shortest path between vertices 1
and 8 is:
1→3→6→8
(d) Discuss the time complexity of the BFS algorithm and its impli-
cations.
The time complexity of the BFS algorithm is O(V + E), where V is the
number of vertices and E is the number of edges in the graph.
Implications:
8
Shortest Path: In unweighted graphs, BFS guarantees the discov-
ery of the shortest path between the starting vertex and any other
vertex. This property makes BFS useful for a wide range of problems
where the shortest path or minimum number of steps is of interest.
Unweighted Graphs: It’s important to note that the BFS al-
gorithm gives the shortest path only for unweighted graphs. For
weighted graphs, algorithms like Dijkstra’s or A* should be used.
8. Connectivity
8.1(a) Define vertex connectivity and edge connectivity of a graph.
Answer:
9
Vertex Connectivity (κ(G)): The vertex connectivity of a graph G
is the minimum number of vertices that need to be removed to make G
disconnected (or trivial, in the case of a complete graph). In other words,
it represents the smallest number of vertices whose removal disconnects
the graph.
This means that removing just one vertex or one edge from the graph will
disconnect it.
8.1(c) Explain the concept of k-connected and k-edge-connected graphs.
Answer:
k-connected graph: A graph is said to be k-connected if its vertex
connectivity is k or more. In other words, a graph is k-connected if at
least k vertices need to be removed to disconnect the graph.
k-edge-connected graph: A graph is said to be k-edge-connected if its
edge connectivity is k or more. This means that at least k edges need to
be removed to disconnect the graph.
10
9. Menger’s Theorem
9.1(a) State and explain Menger’s theorem.
Answer: Menger’s Theorem states that for any two non-adjacent vertices
u and v in a graph, the minimum number of vertices required to separate u and
v (excluding u and v themselves) is equal to the maximum number of internally
vertex-disjoint u − v paths. In other words, it relates the connectivity of two
vertices in a graph to the number of independent paths between them.
9.1(b) Discuss the significance of Menger’s theorem in understanding the
connectivity of graphs.
Answer: Menger’s theorem is a cornerstone in understanding the robustness
and connectivity of graphs. Its importance can be summarized as follows:
Robustness: The theorem offers a means to gauge the reliability of a net-
work. In communication networks, having multiple vertex-disjoint paths
suggests that there are several ways for data to traverse even if some paths
are compromised.
Vertex Connectivity: Menger’s theorem provides an efficient way to de-
termine the vertex connectivity of a graph without evaluating all potential
vertex cuts.
Alternative Paths: In fields like transportation and logistics, the theo-
rem can aid in identifying alternative routes between two points.
9.1(c) Given a graph, use Menger’s theorem to determine the minimum
number of vertices that need to be removed to disconnect the graph.
Answer: For the provided graph, we aim to determine the least number
of vertices necessary to disconnect vertices A and D. Using Menger’s theorem,
we identify the maximum number of internally vertex-disjoint paths between A
and D. For the vertices A and D, there exists only one vertex-disjoint path:
A → B → C → D. Hence, according to Menger’s theorem, removing just one
vertex (either B or C) will disconnect A and D.
9.1(d) Contrast Menger’s theorem with other connectivity concepts in graph
theory.
Answer: While Menger’s theorem elaborates on the number of vertex-
disjoint paths between two non-adjacent vertices, other connectivity concepts
in graph theory include:
Vertex and Edge Connectivity: These concepts describe the minimum
number of vertices or edges, respectively, that need to be removed to make
the graph disconnected.
k-connected and k-edge-connected Graphs: These denote the ro-
bustness of a graph’s connectivity. A k-connected graph stays connected
even after removing k − 1 vertices.
Components: This idea pertains to distinct connected subgraphs within
a graph. Contrarily, Menger’s theorem addresses the connectivity between
specific vertex pairs.
11
In essence, Menger’s theorem provides a specific measure of connectivity be-
tween two particular vertices, while other concepts typically discuss the connec-
tivity of the entire graph or its resilience against vertex or edge removal.
BFS explores nodes level by level. It explores all nodes at the current
depth before moving to nodes at the next depth level.
DFS, on the other hand, explores as far as possible along a branch
before backtracking. It dives deep into a graph, following a path until
it cannot go further, and then it backtracks.
Another key distinction is in the data structures they use: BFS uses a
queue, while DFS uses a stack (or can be implemented using recursion).
(c) How does BFS determine the shortest path in an unweighted
graph? Illustrate with an example.
BFS determines the shortest path in an unweighted graph by exploring
nodes in increasing order of their distance from the source. It starts at
the source node and explores its neighbors, then the neighbors of those
neighbors, and so on. Since BFS explores nodes level by level, the first
time it reaches a node is the shortest path to that node.
10.2.
(a) Given a graph, apply BFS to determine the shortest path be-
tween two specified vertices.
The shortest path between vertices A and H in the graph is:
A→B→E→G→H
12
(b) Discuss the time complexity of the BFS algorithm and its impli-
cations.
The time complexity of the BFS algorithm is O(V + E), where V is the
number of vertices and E is the number of edges in the graph. This is
because each vertex and each edge is processed only once by the BFS
algorithm.
Implications:
BFS is efficient for sparse graphs (where E is much less than V 2 ) but
can be less efficient for dense graphs.
Since the BFS algorithm visits vertices in increasing order of their
distance from the source, it is particularly useful in scenarios where
we want to determine the shortest path in unweighted graphs.
The linear time complexity ensures that BFS can be applied to rela-
tively large graphs efficiently.
(c) In what scenarios would BFS be more appropriate than other
graph traversal methods?
BFS would be more appropriate in the following scenarios:
Shortest Path in Unweighted Graphs: When determining the shortest
path between two vertices in an unweighted graph, BFS provides an
efficient method as it explores all vertices at a given depth before
moving to the next depth.
Layered Approach: In problems where data can be naturally divided
into layers or levels, BFS can be used to process all data at one level
before moving to the next.
Connectivity: To check the connectivity of a graph or to identify
connected components.
Broadcasting: In network topology, BFS can be used in broadcasting
scenarios where a message needs to be sent to all users. It ensures
that users closest to the sender receive the message first.
On the other hand, DFS might be more suitable for scenarios like topo-
logical sorting, detecting cycles, or when the graph’s depth is significantly
smaller than its breadth.
13
meaning there might be smaller edge covers, but a minimum edge cover is an
edge cover with the smallest possible number of edges.
A vertex cover of a graph is a set of vertices such that each edge of the graph
is incident to at least one vertex from the set. A minimum vertex cover is a
vertex cover of smallest size.
(b) Explain the relationship between the size of a minimum vertex
cover and the size of a maximum matching in a graph.
In any graph, the sum of the sizes of a maximum matching and a minimum
vertex cover is equal to the number of vertices in the graph. This relationship can
be particularly useful for certain computational problems, especially in bipartite
graphs where finding a maximum matching can also help determine a minimum
vertex cover.
(c) Given a graph, determine a minimum vertex cover and a min-
imum edge cover.
The minimum vertex cover for the graph consists of vertices: A, B, and C.
The minimum edge cover for the graph consists of the edges: A − D, B − E,
C − B, D − A, E − B, and F − E.
11.2.
(a) Describe an algorithmic approach to find the minimum vertex
cover in a bipartite graph.
To find the minimum vertex cover in a bipartite graph:
1. Start by finding a maximum matching in the bipartite graph using the
Hopcroft-Karp algorithm or other suitable methods.
2. Let U and V be the two disjoint sets of vertices in the bipartite graph.
Determine the unmatched vertices from U .
3. Use BFS (Breadth-First Search) to find all vertices that are at an even
distance from the unmatched vertices in U .
4. Then, find all vertices that are at an odd distance from the unmatched
vertices in V .
5. The minimum vertex cover will be the union of unmatched vertices in U
and the matched vertices in V that are reachable from the unmatched
vertices in U .
(b) Discuss the difference between edge cover and vertex cover
concerning real-world applications.
14
In another example, in a transportation network, it might represent the
minimum number of stations where inspections or security checks need to
be placed to ensure every route is monitored.
Edge Cover: An edge cover can represent scenarios where we want to en-
sure that every node (or location) in a network is directly connected to or
influenced by a selected connection or interaction. For example, in a com-
munication network, an edge cover might represent the minimum number
of direct communication links required to ensure that every device or user
can send or receive data. In a transportation scenario, it might signify the
minimum number of direct routes required to ensure that every location
can be reached directly from another location without intermediate stops.
12. Connectivity
12.1.
(a) Define vertex connectivity and edge connectivity.
15
Power Grids: Electrical power distribution systems are designed with
multiple paths to ensure that power can be rerouted if a particular line
or transformer fails. A well-connected power grid can prevent large-scale
blackouts.
Transportation Networks: Major cities often have multiple routes
(highways, roads) connecting them. If one major highway is closed due
to an accident, traffic can be rerouted through another route, ensuring
continued connectivity.
(c) Given a graph, determine its vertex and edge connectivity.
To determine the vertex and edge connectivity, we look for the smallest
number of vertices or edges whose removal would disconnect the graph.
For the provided graph:
Vertex Connectivity (κ(G)): Removing vertices B and E will discon-
nect the graph. So, the vertex connectivity is 2.
Edge Connectivity (λ(G)): Removing edges A − D, B − D, and B − E
will disconnect the graph. Thus, the edge connectivity is 3.
12.2.
(a) Discuss the implications of k-connectivity in graphs.
K-connectivity in graphs implies that there are at least k distinct paths
between any two vertices, and no set of k − 1 vertices (or edges for edge-
connectivity) can disconnect the graph. This robustness can have several impli-
cations:
Reliability: A k-connected network can tolerate the failure of k −1 nodes
or connections without losing its overall connectivity.
Redundancy: The presence of multiple paths provides alternative routes
for communication or transportation, ensuring continued operation in case
of localized failures.
Fault Tolerance: In computer networks, k-connectivity can allow for
load balancing and congestion management since multiple paths can han-
dle traffic simultaneously.
(b) How can one determine if a graph is k-connected?
To determine if a graph is k-connected:
1. Check if the graph has more than k vertices. If not, it can’t be k-connected.
2. For every pair of vertices, ensure that there are at least k vertex-disjoint
paths between them.
3. Alternatively, for vertex connectivity, check if no set of k − 1 vertices can
disconnect the graph. For edge connectivity, check if no set of k − 1 edges
can disconnect the graph.
16
Using algorithms like max-flow/min-cut, one can determine the minimum
number of vertices or edges whose removal can disconnect the graph, which
gives the vertex or edge connectivity, respectively.
13.1.
(a) State Menger’s theorem and discuss its significance in graph the-
ory.
Menger’s theorem is a foundational result in graph theory, connecting the
concepts of vertex and edge connectivity with the existence of independent paths
between vertices.
Statement of Menger’s Theorem: For any two non-adjacent vertices u and
v in a graph G:
17
vertex connectivity between those two vertices. Similarly, the minimum number
of edges required to disconnect two vertices is equal to the maximum number
of edge-disjoint paths between them, which gives the edge connectivity. Thus,
Menger’s theorem provides a way to determine the vertex and edge connectivity
of a graph.
13.2.
(a) How can Menger’s theorem be applied in network reliability anal-
ysis?
Network reliability analysis often involves assessing the vulnerability of a
network to failures. Menger’s theorem can be applied in this context to under-
stand how robust a network is against such failures. Specifically:
1. By determining the minimum number of vertices (or edges) that need
to be removed to disconnect the network (or parts of it), we can assess
the network’s vulnerability. A higher number indicates a more reliable
network as more failures are needed to disrupt connectivity.
2. Menger’s theorem can help in designing backup routes in communica-
tion networks. By identifying multiple independent paths between critical
nodes, one can ensure that even if one path fails, there are alternative
routes available.
3. It aids in identifying critical nodes or edges whose failure could be partic-
ularly detrimental to the network’s operation.
(b) Discuss real-world applications where Menger’s theorem plays
a crucial role in decision-making.
1. Internet Infrastructure: In designing robust internet backbones, Menger’s
theorem can help identify critical nodes and paths. Ensuring multiple
independent paths between major data centers can prevent large-scale
outages.
2. Transport Networks: In urban planning and transportation, Menger’s the-
orem can be used to ensure that there are multiple independent routes
connecting key locations, making the transportation system more resilient
to road closures or disruptions.
3. Power Grids: In electrical engineering, ensuring multiple independent
paths for electricity flow can prevent blackouts if certain lines or sub-
stations fail.
4. Supply Chain Management: Companies can use principles from Menger’s
theorem to ensure that they have multiple independent supply routes,
making their supply chain more resilient to disruptions.
Menger’s theorem, with its focus on connectivity and redundancy, plays
a pivotal role in any decision-making process where reliability and robustness
against failures are critical.
18