1. A method comprising, by a computing device: 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-user 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 a client system of the first user, an unstructured text query inputted by the first user, wherein the unstructured text query comprises one or more n-grams; identifying, based on the unstructured text query, one or more edges and one or more second nodes of the social graph, each of the identified edges or identified nodes corresponding to at least one of the n-grams, wherein identifying the one or more edges and one or more second nodes comprises: determining a second score for each n-gram that corresponds to one of the edges or second nodes; selecting one or more edges having a second score greater than an edge-threshold score, each of the identified edges corresponding to at least one of the n-grams; and selecting one or more second nodes having a second score greater than a node-threshold score, each of the identified second nodes being connected to at least one of the identified edges, each of the identified second nodes corresponding to at least one of the n-grams; accessing a context-free grammar model comprising a plurality of grammars, each grammar comprising one or more query tokens; identifying one or more grammars, each identified grammar having one or more query tokens corresponding to at least one of the identified second nodes and at least one of the identified edges of the social graph; determining a first score for each identified grammar; generating one or more structured queries, each structured query corresponding to an identified grammar having first score greater than a grammar-threshold score wherein the structured query comprises a natural-language string generated by the identified grammar, each structured query comprising the query tokens of the corresponding identified grammar, wherein one or more of the query tokens of the structured query corresponds to at least one of the identified second nodes and at least one of the or identified edges of the social graph; and sending, to the client system of the first user, one or more of the structured queries as suggested queries for display to the first user in response to the unstructured text query inputted by the first user.