ABSTRACT

Navigation systems, social networks, and airport connections are all powered by Graphs. By abstracting real-world locations into Nodes and their connections into Edges, we can solve complex problems like finding the “shortest path” between any two points in the world.


1. What is a Graph?

A graph is a mathematical structure used to model relationships between objects. It consists of:

  • Nodes (or Vertices): The individual elements or “locations” in the system.
  • Edges: The connections between pairs of nodes.

Unlike trees, graphs have no strict hierarchy. They can be:

  • Disconnected: Some nodes have no paths between them.

  • Sequential: Nodes follow a linear path.

  • Hierarchical: Organized like a tree (though trees are actually just a specific type of graph).

  • Complex: A mix of connected and disconnected components.


2. Formal Definition

A graph is formally represented as an ordered pair :

  • : A set of vertices .
  • : A set of edges, where each edge is a pair of vertices .

Example

The size of a graph is denoted by

  • (number of vertices)
  • (number of edges).

3. Classifying Graphs

Graphs are categorized based on how their edges behave:

Directed vs. Undirected

  • Directed Graph: Edges have a specific direction (one-way). means you can go from to , but not necessarily back.

  • Undirected Graph: Edges are bidirectional. is equivalent to .

Weighted vs. Unweighted

  • Weighted Graph: Each edge has a “cost” or “weight” (e.g., distance or travel time).

  • Unweighted Graph: All edges are considered equal (effectively having a weight of 1).

4. Paths and Cycles

  • Path: A sequence of edges connecting a start node to an end node.

  • Cycle: A path that starts and ends at the same node.

  • DAG (Directed Acyclic Graph): A directed graph that contains no cycles.

More information can be found here


5. Summary of Properties

PropertyDescriptionReal-World Example
DirectedEdges have arrows/directionOne-way streets; Twitter followers
UndirectedEdges are bidirectionalTwo-way streets; Facebook friends
WeightedEdges have numerical valuesDistance in miles; Toll costs
AcyclicNo paths loop back to startPrerequisites for a college major
Folder Contents

3 items under this folder.