1. A method comprising: 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 a structured query comprising references to one or more selected nodes from the plurality of nodes and one or more selected edges from the plurality of edges; generating a query command based on the structured query, wherein the query command comprises an inner query constraint and an outer query constraint; identifying a first set of nodes matching the inner query constraint and at least in part matching the outer query constraint; identifying a second set of nodes matching the outer query constraint; and generating one or more search results based on the first and second sets of nodes, wherein each search result corresponds to a node of the plurality of nodes.