Are These Two Friends? Adjacency Lists and Grids

Answer "are these two already friends?" in one step without running out of memory, before every Add friend button: why reading a friend list and a box for every pair both fall short at a million people, and how to choose between an adjacency list, a set per person and an adjacency matrix.

Updated

Cheat sheet: Are These Two Friends? Adjacency Lists and Grids
Category
Data Structures
Level
Journeyman
Tags
Adjacency List, Adjacency Matrix, data structures, Edge, Graph, Vertex