This. Tables are an efficient implementation of general graphs. It’s the best one I know of (unless your graph can be specialized).