Unit 4 - Notes

MTH401

Unit 4: Graphs theory I

1. Graph Terminologies

Basic Definitions

A Graph is defined as an ordered pair , where:

  • is a non-empty set of elements called vertices (or nodes).
  • is a set of elements called edges (or arcs). Each edge connects two vertices.

Directed vs. Undirected

  • Undirected Graph: Edges are unordered pairs . The edge connects and both ways.
  • Directed Graph (Digraph): Edges are ordered pairs . The edge goes from to .
    • is the initial vertex.
    • is the terminal vertex.

Vertex and Edge Relationships

  • Adjacency: Two vertices are adjacent (or neighbors) if they are connected by an edge.
  • Incidence: An edge is incident to the vertices it connects.
  • Loop: An edge that connects a vertex to itself ().
  • Parallel Edges (Multiple Edges): Two or more distinct edges that connect the same pair of vertices.
  • Simple Graph: A graph with no loops and no parallel edges.
  • Multigraph: A graph that allows parallel edges.
  • Pseudograph: A graph that allows both loops and parallel edges.

Degrees of Vertices

  • Degree (Undirected): The number of edges incident to vertex , denoted .
    • Note: A loop contributes 2 to the degree.
  • Isolated Vertex: A vertex with .
  • Pendant Vertex: A vertex with .

The Handshaking Theorem:
In an undirected graph with edges, the sum of degrees of all vertices is twice the number of edges.


Corollary: An undirected graph has an even number of vertices of odd degree.

Degrees in Directed Graphs

  • In-degree (): Number of edges coming into .
  • Out-degree (): Number of edges going out of .
  • Theorem: .

2. Special Types of Graphs

Complete Graph ()

A simple graph containing exactly one edge between each pair of distinct vertices.

  • Vertices:
  • Edges:
  • Regularity: Every vertex has degree .

Cycle Graph ()

A graph consisting of vertices and edges .

  • Requires .
  • Every vertex has degree 2.

Wheel Graph ()

Constructed by taking a cycle graph and adding an additional vertex (hub) connected to all vertices of the cycle.

  • Vertices:
  • Edges:
  • (Note: Some texts define the size differently; usually denotes a wheel with rim vertices).

n-Cube (Hypercube, )

A graph with vertices representing bit strings of length . Two vertices are adjacent if their bit strings differ by exactly one bit.

  • Vertices:
  • Edges:
  • Degree: Every vertex has degree .

Bipartite Graph

A graph is bipartite if its vertex set can be partitioned into two disjoint sets and such that every edge connects a vertex in to one in .

  • No edge connects two vertices within the same partition.
  • Theorem: A simple graph is bipartite if and only if it contains no odd length simple cycles.

Complete Bipartite Graph ()

A bipartite graph where every vertex in set (size ) is connected to every vertex in set (size ).

  • Edges:
  • Degrees: Vertices in have degree ; vertices in have degree .

Regular Graph

A simple graph where every vertex has the same degree . It is called a -regular graph.

  • is -regular.
  • is 2-regular.

3. Representing Graphs

Adjacency Matrix

Let be a simple graph with vertices labeled . The adjacency matrix is an matrix where:

  • Properties:
    • Symmetric for undirected graphs ().
    • Sum of a row equals .
    • For directed graphs, if there is an edge from to . It is not necessarily symmetric.
    • Powers of the matrix () reveal connectivity: is the number of walks of length from to .

Incidence Matrix

Let be an undirected graph with vertices () and edges (). The incidence matrix is an matrix where:

  • Properties:
    • Every column sums to 2 (since every edge connects two vertices).
    • Row sums give the degree of the vertex.

4. Graph Isomorphism

Two simple graphs and are isomorphic if there exists a one-to-one and onto function (bijection) such that:

Checking for Isomorphism

It is computationally difficult to prove isomorphism for large graphs, but easy to prove non-isomorphism by checking invariants (properties preserved under isomorphism).

Necessary Conditions (Invariants):
If and are isomorphic, they must have the:

  1. Same number of vertices ().
  2. Same number of edges ().
  3. Same degree sequence (list of vertex degrees sorted in non-decreasing order).
  4. Same connectivity/cycle structures (e.g., if has a cycle of length 3, must also).

Note: Satisfying these conditions does not guarantee isomorphism, but failing any of them guarantees non-isomorphism.


5. Path and Connectivity

Definitions of Traversal

  • Walk: A sequence of alternating vertices and edges. Repeated edges and vertices allowed.
  • Trail: A walk with no repeated edges.
  • Path: A walk with no repeated vertices (implies no repeated edges).
  • Cycle (Circuit): A path that starts and ends at the same vertex () with length .

Connectivity in Undirected Graphs

  • Connected Graph: There is a path between every pair of distinct vertices.
  • Connected Component: A maximal connected subgraph.
  • Cut Vertex (Articulation Point): A vertex whose removal increases the number of connected components.
  • Cut Edge (Bridge): An edge whose removal increases the number of connected components.

Connectivity in Directed Graphs

  • Strongly Connected: For every pair of vertices , there is a directed path from to AND from to .
  • Weakly Connected: The underlying undirected graph (ignoring edge directions) is connected.

6. Dijkstra’s Algorithm

Problem: Find the shortest path from a source vertex () to all other vertices in a weighted graph.
Prerequisite: Edge weights must be non-negative.

Terminology

  • : Weight of edge .
  • : Label representing the tentative shortest distance from source to .
  • : Set of visited (permanently labeled) vertices.

Algorithm Steps

  1. Initialization:
    • Set .
    • Set for all other .
    • Set .
  2. Selection:
    • Choose a vertex not in with the minimum .
    • Add to .
  3. Relaxation:
    • For every neighbor of that is not in :
      • New Distance .
      • If New Distance , update New Distance.
  4. Termination:
    • Repeat steps 2 and 3 until all vertices are in (or destination is reached).

Pseudocode

TEXT
function Dijkstra(Graph, source):
    create vertex set Q

    for each vertex v in Graph:
        dist[v] ← INFINITY
        prev[v] ← UNDEFINED
        add v to Q
      
    dist[source] ← 0
      
    while Q is not empty:
        u ← vertex in Q with min dist[u]
        remove u from Q
          
        for each neighbor v of u:
            alt ← dist[u] + weight(u, v)
            if alt < dist[v]:
                dist[v] ← alt
                prev[v] ← u

    return dist[], prev[]

Complexity

  • Using an array: .
  • Using a Min-Priority Queue (Binary Heap): .