module 1-Discrete Structure (2)
module 1-Discrete Structure (2)
A. Graph properties
1. Connectivity
➢ the degree to which a graph is
"connected." It measures how
easily one can travel between
vertices (nodes) in a graph. There
are two main types of
connectivity:
➢ It is important in various
applications, such as network
design, communication, and
transportation systems. Highly
connected graphs are often more
resilient to failures.
The image above is a complete graph, specifically K6, where all six vertices
are connected to each other by edges. In graph theory, the vertex connectivity of
a graph is the minimum number of vertices that need to be removed to
disconnect the graph or reduce it to a single vertex.
For a complete graph Kn, the vertex connectivity is n−1. This is because, in a
complete graph, each vertex is connected to every other vertex. Therefore:
This means that to disconnect the graph (or make it into a trivial graph
with a single vertex), you would need to remove at least 5 vertices. Removing
fewer than 5 vertices from K6 would still leave at least two vertices connected by
an edge.
The image above is a directed graph (digraph) with seven vertices labeled
a, b, c, d, e, f, and g. In graph theory, edge connectivity refers to the minimum
number of edges that need to be removed to disconnect the graph.
The edge connectivity of this graph is 2, meaning at least two edges must
be removed to disconnect the graph or isolate a vertex from the rest of the graph.
This is determined by finding the smallest "cut set" of edges that would separate
the graph into disconnected components.
2. Planarity
https://www.geeksforgeeks.org/eulerian-path-and-circuit/
▪ For a graph to have an Eulerian cycle, all vertices must have even
degrees.
https://www.geeksforgeeks.org/eulerian-path-and-circuit/
1. Kruskal's Algorithm
➢ a greedy algorithm that constructs a minimum spanning tree by
iteratively adding edges of increasing weight while ensuring that no
cycle is formed.
Algorithm Steps:
1. Sort all the edges of the graph in ascending order of their weights.
2. Initialize an empty set to store the edges of the MST.
3. Iterate through the sorted edges. For each edge, if adding it to the MST
doesn't create a cycle, add the edge to the MST.
4. Continue this process until the MST has V-1 edges (V is the number of
vertices in the graph) or all edges have been considered.
Example
AB: 2
AC: 3
BC: 4
BD: 5
BE: 6
CD: 7
CE: 8
DE: 9
The minimum spanning tree obtained using Kruskal's algorithm could be:
AB: 2
AC: 3
BD: 5
BE: 6
2. Prim's Algorithm
➢ another greedy approach that starts with an arbitrary vertex and
incrementally grows the minimum spanning tree by adding the edge
with the minimum weight that connects a vertex in the tree to a
vertex outside the tree.
Algorithm Steps:
Example
Using the same graph and weights as in the Kruskal's algorithm example,
if we start with vertex A, the minimum spanning tree obtained using Prim's
algorithm could be:
AB: 2
AC: 3
BC: 4
BD: 5