Graph Edge — Definition, Formula & Examples
A graph edge is a connection linking two vertices (nodes) in a graph. Each edge represents a relationship or link between a pair of vertices.
In a graph , an edge is an element of a set of unordered pairs (in an undirected graph) or ordered pairs (in a directed graph) drawn from the vertex set . For an undirected graph, an edge connecting vertices and is written ; for a directed graph, denotes an edge from to .
How It Works
An edge always connects exactly two vertices (or a vertex to itself, in the case of a loop). In an undirected graph, the edge is the same as . In a directed graph (digraph), the edge goes from to , so order matters. A weighted edge carries an additional numerical value representing cost, distance, or capacity. The degree of a vertex counts how many edges are incident to it.
Worked Example
Problem: Given the graph with and , determine the number of edges and the degree of vertex .
Count the edges: List each element of . There are four unordered pairs.
Find the degree of C: Vertex appears in the edges , , and . Each occurrence adds one to its degree.
Answer: The graph has 4 edges, and vertex has degree 3.
Why It Matters
Edges model real connections — roads between cities, friendships in social networks, links between web pages. Algorithms like Dijkstra's shortest path and Kruskal's minimum spanning tree operate directly on edges and their weights, making this concept foundational for computer science and operations research.
Common Mistakes
Mistake: Treating an undirected edge as two separate edges.
Correction: In an undirected graph, and refer to the same single edge. Only in a directed graph are and distinct.
