A method comprising, by one or more computing systems: receiving a search query, wherein the search query comprises a query content object and one or more query constraints; generating a feature vector representing the query content object: accessing a sparse graph comprising a plurality of nodes corresponding to a plurality of candidate content objects and a plurality of links connecting the nodes, wherein a number of links connecting to any particular node is less than a threshold number of links, and wherein each candidate content object is represented by a compact code; selecting an entry node from the plurality of nodes of the sparse graph selecting, from the plurality of candidate content objects, one or more similar content objects with respect, to the query content object, wherein the one: or more similar content objects are iteratively selected by: identifying one or more linked nodes of the entry node, wherein each linked node is connected to the entry node by a link; decompressing, for each candidate content object corresponding to the linked node, the compact code representing the candidate content object to generate a feature vector representing the candidate content object; selecting, based on a comparison between the feature vector representing the query content object and the feature vectors representing the candidate content objects, zero or more similar content objects from the candidate content objects; determining, if a completion condition is reached for the selecting of the one or more similar content objects, wherein the completion condition is determined based on the one or more query constraints; and based on the determining; if the completion condition is satisfied, then returning the one or more selected similar content objects; else if the completion condition is not satisfied, then repeating the iterative selection by using a linked node corresponding to a most similar content object from the one or more linked nodes as the entry node; and sending, to a client system associated with a user, instructions for presenting one or more of the selected similar content objects responsive to receiving the search query. receiving a search query, wherein the search query comprises a query content object and one or more query constraints; generating a feature vector representing the query content object: accessing a sparse graph comprising a plurality of nodes corresponding to a plurality of candidate content objects and a plurality of links connecting the nodes, wherein a number of links connecting to any particular node is less than a threshold number of links, and wherein each candidate content object is represented by a compact code; selecting an entry node from the plurality of nodes of the sparse graph selecting, from the plurality of candidate content objects, one or more similar content objects with respect, to the query content object, wherein the one: or more similar content objects are iteratively selected by: identifying one or more linked nodes of the entry node, wherein each linked node is connected to the entry node by a link; decompressing, for each candidate content object corresponding to the linked node, the compact code representing the candidate content object to generate a feature vector representing the candidate content object; selecting, based on a comparison between the feature vector representing the query content object and the feature vectors representing the candidate content objects, zero or more similar content objects from the candidate content objects; determining, if a completion condition is reached for the selecting of the one or more similar content objects, wherein the completion condition is determined based on the one or more query constraints; and based on the determining; identifying one or more linked nodes of the entry node, wherein each linked node is connected to the entry node by a link; decompressing, for each candidate content object corresponding to the linked node, the compact code representing the candidate content object to generate a feature vector representing the candidate content object; selecting, based on a comparison between the feature vector representing the query content object and the feature vectors representing the candidate content objects, zero or more similar content objects from the candidate content objects; determining, if a completion condition is reached for the selecting of the one or more similar content objects, wherein the completion condition is determined based on the one or more query constraints; and based on the determining; if the completion condition is satisfied, then returning the one or more selected similar content objects; else if the completion condition is not satisfied, then repeating the iterative selection by using a linked node corresponding to a most similar content object from the one or more linked nodes as the entry node; and sending, to a client system associated with a user, instructions for presenting one or more of the selected similar content objects responsive to receiving the search query.