private void collectPaths(
            Map<ShapeId, List<EntityShape>> paths,
            Deque<EntityShape> path,
            Shape current,
            NeighborProvider neighborProvider
    ) {
        for (Relationship relationship : neighborProvider.getNeighbors(current)) {
            Shape neighbor = relationship.expectNeighborShape();
            if (!neighbor.isOperationShape() && !neighbor.isResourceShape()) {
                continue;
            }

            // Note: The path does not include the neighbor shape
            paths.put(neighbor.getId(), ListUtils.copyOf(path));

            // Recurse through neighbors of an entity (resource) shape
            if (neighbor instanceof EntityShape) {
                path.push((EntityShape) neighbor);
                collectPaths(paths, path, neighbor, neighborProvider);
                path.pop();
            }
        }
    }
Computes all of the parent shapes of resources and operations from the bottom-up.
smithy-model/src/main/java/software/amazon/smithy/model/knowledge/BottomUpIndex.java