1. An article of manufacture, comprising: a computer readable medium; and instructions stored in the computer readable medium which, when executed by one or more computers, cause the one or more computers to perform operations comprising: obtaining data representing entities, each entity being a query, a document, a session of queries, a time, or a domain of a document; identifying a plurality of pairs of entities from a subset of the entities from search history data, where each pair is either: (1) (i) a query paired with (ii) another query, a document, a session of queries, or a time, or (2) (i) a document paired with (ii) a session of queries, or (3) two documents paired with each other, and where the plurality of pairs of entities comprise a first pair of entities that is a first document paired with a first session of queries and a second pair of entities that is a second session of queries paired with a second document; generating, for each pair of entities, using the search history data, a respective directed relationship having a respective strength value and connecting a first entity of the pair to a second entity of the pair; and determining, for any two entities that are directly or indirectly connected through directed relationships, a relevance score from strength values of the directed relationships connecting the two entities.