3. Edge List

Introduction

The Edge List is a straightforward data structure used to represent the edges of a graph. It consists of tuples or objects, where each element represents an edge and contains information about its start vertex, end vertex, and potentially other attributes like edge weight.

The Edge List provides a compact representation of the edges in the graph, without explicitly storing information about vertices. It is particularly useful when the focus is primarily on analyzing the connectivity and relationships between edges.

However, it is worth noting that the Edge List alone does not provide direct information about the vertices or their adjacency relationships. To perform certain graph algorithms or traverse the graph efficiently, additional data structures like the Adjacency List or Adjacency Matrix may be required.

Exercise

  1. 1.

    Edit the undirected graph so that it is equal to the edge list below:

    [ [0, 1], [0, 2], [0, 3], [1, 4], [2, 4] ]
  2. 2.

    Edit the directed graph so that it is equal to the edge list below:

    [ [0, 1], [0, 2], [1, 3], [2, 0], [3, 1], [4, 0] ]

You may notice that once you have completed the first exercise with 5 vertices, adding more vertices will not change the edge list. This is because the edge list does not store information about vertices. So there is no way to draw a specific graph with only the edge list.

::content-navigation

prevLink: /tutorial/representation/adjacency-list prevTitle: Adjacency List nextLink: /tutorial/algorithm/depth-first-search nextTitle: Depth First Search


::

Node Index:

Node ID:

012345

Edge List

    [
  • [0,1],
  • [0,2]
  • ]