Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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}
share|improve this question
up vote 1 down vote accepted

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.

share|improve this answer
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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.