# Testing Equality Expression?

Even if in

Graph[{1 -> 2}] == Graph[{1 \[DirectedEdge] 2}]


the answer is True ; but why MMA doesn't show the result of the following expression?Neither True nor False.What is the reason?

{1 -> 2} == {1 \[DirectedEdge] 2}

-

You can often figure this kind of thing out by looking at the FullForm of the expressions. In this case:

{FullForm[{1 -> 2}], FullForm[{1 \[DirectedEdge] 2}]}


shows that the first is a Rule while the second is a DirectedEdge and hence they are not equal. On the other hand, when embedded inside Graph, both sides become

Graph[List[1, 2], List[DirectedEdge[1, 2]]]


and hence are equal.

-
Thanks but then why it doesn't show the False? – Alex Oct 3 '13 at 0:23
It shows True when both sides are the same. It shows False when the two sides are different. To see the False use the triple equals: {1 -> 2} === {1 \[DirectedEdge] 2}does indeed return False. It's the difference between "equals" and "identical" or Equals and SameQ. – bill s Oct 3 '13 at 0:32
@Alex As bill s says, == and === are different and you probably were looking for ===. Also see: Evaluating an If condition to yield True/False – R. M. Oct 3 '13 at 1:03