View on GitHub

Notes

reference notes

What is Graph?

Graph Application

Graphs find applications in various real-life problems across different domains:

Math:

Social Sciences:

Biology:

Computer Science:

Physics & Chemistry:

Other:

Types of Graph

  1. Finite Graph:
    • Finite vertices and edges.
  2. Infinite Graph:
    • Infinite vertices and edges.
  3. Trivial Graph:
    • One vertex, no edge.
  4. Null Graph:
    • Order (n) vertices, no edges.
  5. Simple Graph:
    • No more than one edge between vertices.
  6. Directed Graph (Digraph):
    • Edges map onto ordered pairs of vertices.
  7. Undirected Graph:
    • No direction in edges.
  8. Weighted Graph:
    • Edges have associated costs.
  9. Multi Graph:
    • May contain parallel edges, no self-loop.
  10. Pseudo Graph:
    • Contains self-loop and multiple edges.

Graph Representation

Shortest Path Algorithm: Dijkstra’s Algorithm

Spanning Tree

Kruskal’s Algorithm

  1. Sort edges in non-decreasing order.
  2. Pick smallest edge; include if no cycle formed.
  3. Repeat until (V-1) edges in spanning tree.

Examples and Exercises:

Graph Application Exercise (Pos Laju Malaysia):

Conclusion: