A protocol extension supplies fully implemented functions and members to a protocol, letting conforming graph types reuse core behavior before a concrete graph type exists. section 4.1
A graph protocol extension can provide:
- Vertex lookup by index or by an Equatable vertex value. section 4.1
Reusable graph behavior
An UnweightedGraph<String> stores cities as vertices and uses inherited extension methods to add edges such as Seattle–Chicago and Seattle–San Francisco, then prints adjacency lists.
