1. A method comprising, by one or more computing devices: accessing a social graph comprising a plurality of nodes and a plurality of edges connecting the nodes, each of the edges between two of the nodes representing a single degree of separation between them, the nodes comprising: a first node corresponding to a first user associated with an online social network; and a plurality of second nodes that each correspond to a concept or a second user associated with the online social network; receiving from the first user an unstructured text query comprising one or more n-grams; identifying one or more of the second nodes, each of the identified second nodes corresponding to one or more of the n-grams; identifying one or more of the edges, each of the identified edges being connected to at least one of the identified second nodes, each of the identified edges corresponding to one or more of the n-grams; and generating one or more structured queries that each comprise references to one or more of the identified second nodes and one or more of the identified edges.
1. A method comprising, by one or more computing devices: accessing a social graph comprising a plurality of nodes and a plurality of edges connecting the nodes, each of the edges between two of the nodes representing a single degree of separation between them, the nodes comprising: a first node corresponding to a first user associated with an online social network; and a plurality of second nodes that each correspond to a concept or a second user associated with the online social network; receiving from the first user an unstructured text query comprising one or more n-grams; identifying one or more of the second nodes, each of the identified second nodes corresponding to one or more of the n-grams; identifying one or more of the edges, each of the identified edges being connected to at least one of the identified second nodes, each of the identified edges corresponding to one or more of the n-grams; and generating one or more structured queries that each comprise references to one or more of the identified second nodes and one or more of the identified edges. 6. The method of claim 1 , further comprising ranking each of the structured queries based on the degree of separation between the first node and at least one of the identified second nodes referenced in the structured query.