liveBook · Manning

Bidirectional edge

As explained in Classic Computer Science Problems in Swift: Essential techniques for practicing programmers

A graph edge that permits travel between its two endpoint vertices in both directions.

A bidirectional edge connects two endpoint vertices and permits travel in either direction. In the graph framework, u and v identify the endpoints, while reversed produces the opposite orientation when needed. section 4.1

City connections

Adding a Seattle-to-Chicago edge lets the graph report Chicago as a Seattle neighbor and Seattle as a Chicago neighbor. Printing the city graph exposes both directions in its adjacency lists.

How Classic Computer Science Problems in Swift: Essential techniques for practicing programmers covers it

How deep it goes
Defines endpoints, reversal, and adjacency-list insertion but stops short of graph traversal algorithms.
Examples
Uses a city-route graph and reciprocal Seattle, Chicago, and neighboring-city listings.
What you can do after
Build it from scratch by defining an Edge type and inserting each connection in both endpoint adjacency lists.
How it connects
Connects graph vertices with adjacency lists, directed graphs, generics, and Swift protocols.

This explainer was generated by Manning's knowledge graph from the text of Classic Computer Science Problems in Swift: Essential techniques for practicing programmers. The section links point to the parts of the book it draws on.