def search(httpreq: Request, request: GraphSearchRequest) -> GraphSearchResponse:
    """Fetches neighbros for a given Yeti Object."""
    object_type, object_id = request.source.split("/")
    if object_type not in GRAPH_TYPE_MAPPINGS:
        raise HTTPException(
            status_code=400, detail=f"Invalid object type: {object_type}"
        )
    yeti_object = GRAPH_TYPE_MAPPINGS[object_type].get(object_id)
    if not yeti_object:
        raise HTTPException(
            status_code=404, detail=f"Source object {request.source} not found"
        )
    vertices, paths, total = yeti_object.neighbors(
        link_types=request.link_types,
        target_types=request.target_types,
        direction=request.direction,
        filter=request.filter,
        include_original=request.include_original,
        graph=request.graph,
        min_hops=request.min_hops or request.hops,
        max_hops=request.max_hops or request.hops,
        count=request.count,
        offset=request.page * request.count,
        sorting=request.sorting,
        user=httpreq.state.user,
    )
    return GraphSearchResponse(vertices=vertices, paths=paths, total=total)
Fetches neighbros for a given Yeti Object.
core/web/apiv2/graph.py