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; parsing the structured query to identify a first query constraint and one or more second query constraints; identifying an inverse constraint associated with the first query constraint, wherein the first query constraint has been previously flagged as identifying greater than a threshold number of nodes; and generating a query command based on the structured query, wherein the query command comprises the inverse constraint and the one or more second query constraints.