private Stream<Relationship> findRelationshipsTo(Shape shape) {
            return reverseProvider.getNeighbors(shape)
                    .stream()
                    // We are only interested in references to this shape from
                    // other shapes, not references to this shape that the shape
                    // contains (like members).
                    .filter(rel -> {
                        RelationshipType type = rel.getRelationshipType();
                        return type.getDirection() == RelationshipDirection.DIRECTED && !type.isMemberBinding();
                    })
                    // Don't allow recursive member references to exclude themselves.
                    // This check ensures that recursive member references don't exclude
                    // themselves from being marked by seeing if the relationship is a member
                    // target (e.g., an aggregate shape that targets a member)
                    .filter(rel -> rel.getRelationshipType() != RelationshipType.MEMBER_TARGET
                            || !rel.getShape().getId().withoutMember().equals(rel.getNeighborShapeId()));
        }
Gets the set of shapes that refer to the given shape.

@param shape Shape to check for relationships to.
@return Returns the shapes that reference the given shape.
smithy-model/src/main/java/software/amazon/smithy/model/transform/MarkAndSweep.java