Devising a way to spot a contradiction given a set of statements using graphs
First, you can consider only the equality relationships and build an undirected graph with each edge representing each equality relationship. Then you can simply apply BFS or DFS to partition this graph into connected components. 

Next you can consider the "&lt;" and ">" relationships. You can treat each connected component as a vertex and add directed edges so that $(u,v)$ represents the relationship $u&lt;v$. Then you can detect if there is a cycle in the directed graph by DFS again. If there is cycle, there is a contradiction among these relationships; otherwise the relationships we processed so far are consistent.

At last you can consider the "$\neq$" relationships. You can simply check for each relationship $a\neq b$ if $a$ and $b$ belong to the same connected component. If $a$ and $b$ belong to different connected components for all relationships $a\neq b$, then all the relationships are consistent; otherwise there is a contradiction.