Graph Basics

Master the fundamental building blocks of network analysis. Graphs are mathematical structures that model relationships between entities — from social networks to the web to transportation systems.

What is a Graph?

A graph (or network) is a collection of nodes (also called vertices or actors) connected by edges (also called links or ties). Graphs let us represent and analyse relationships: friendships in a social network, hyperlinks between web pages, or roads between cities.

An example network with 8 nodes and multiple connections. Click and drag nodes to explore the structure.

Key Terminology

Node / Vertex / Actor

An entity in the network — a person, web page, airport, or any object of interest.

Edge / Link / Tie

A connection between two nodes, representing a relationship, hyperlink, road, or interaction.

Directed vs Undirected

Directed: Edges have a direction (e.g., follows on Twitter).
Undirected: Edges are mutual (e.g., Facebook friendships).

Weighted Graph

Edges have numerical values representing strength, cost, or frequency of interaction.

Neighbourhood

The set of nodes directly connected to a given node. Neighbours are one hop away.

Degree

The number of edges connected to a node. In directed graphs, we distinguish in-degree (incoming edges) and out-degree (outgoing edges).

Interactive Graph Explorer

Click a node to see its neighbours and degree. Toggle between directed and undirected modes, and view the graph's adjacency matrix or adjacency list.

Shortest Path Finder

A path is a sequence of nodes connected by edges. The shortest path between two nodes is the path with the fewest edges. We use breadth-first search (BFS) to find it.

Connected Components

A connected component is a subset of nodes where every node can reach every other node via some path. In an undirected graph, connected components partition the network into isolated clusters.

Note: The example graph is fully connected (1 component). Try mentally removing edges — if you split the graph, you'd get multiple components.