Search⌘ K
AI Features

Introduction to Graphs

Explore the fundamental concepts of graphs, including vertices, edges, and paths. Understand graph representations and basic algorithms to add, remove, and check edges. This lesson helps you grasp how graphs model various applications and prepares you to implement efficient graph structures in Java.

Graphs overview

In this module, we study two representations of graphs and basic algorithms that use these representations.

Mathematically, a (directed) graph is a pair G=(V,E)G = (V ,E) where VV is a set of vertices and EE is a set of ordered pairs of vertices called edges. An edge (i,j)(i,j) is directed from ii to jj; ii is called the source of the edge and jj is called the target. A path in GG is a sequence of vertices v0,...,vkv_0,..., v_k ...