Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

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

I am having a strange issue with PathGraph. Executing

PathGraph[{a, b, c}]

or PathGraph[{1,2,3}], etc., returns a path-graph with three vertices as expected. However, executing:

In[10]:= PathGraph[{v1, v2, v3}]
Out[10]= PathGraph[{v1, v2, v3}]

That is, it stays unevaluated instead of returning the Graph object. I tried several variations and apparently the issue occurs whenever v2 is among the vertices. That is all of PathGraph[{a1, v2, a3}], PathGraph[{v2, x}], PathGraph[{1, 2, v2, x}], etc. remain unevaluated after execution.

I tried this on two computers, both with clean Kernels (with no definitions made or packages loaded, etc.).

Mathematica version:

Can anyone reproduce this? Is this a bug?

Update: This is working correctly in version 9.

share|improve this question
I can repro this one. Awful. – Dr. belisarius Jun 3 '12 at 4:59
Me too. Also, neither of these work either: PathGraph[{j, k, l}]; PathGraph[{v, w, x}] – Jagra Jun 3 '12 at 5:07
Daniel Lichtblau has, on several occasions, commented/answered saying that such bugs are often caused by some internal variable sorting or issues with hashing. There is no way to predict which ones will fail, but they fix them as they find them. Here's a rather nasty bug on versions 7 and below (fixed in 8 onwards) that's somewhat related. I'd suggest emailing to – R. M. Jun 3 '12 at 5:21
I emailed them. Waiting for reply. – becko Jun 3 '12 at 16:10
@becko Please share the reply when you get one. – Szabolcs Jun 4 '12 at 7:19
up vote 6 down vote accepted

This is definitely a bug. I emailed Wolfram support and got the following reply:


Thank you for your email.

I have reproduced this problem. It seems that PathGraph doesn't like variable names like v2, x, and l, but generally works for other variable names. I have filed a report with our developers on this issue. Your contact information has been added to the report so that you can be notified when this problem is resolved.

If I hear any intermediate feedback from the developers, I will be sure to pass it on to you. Right now, but guess is that there is some sort of collision between the variable names and some internal variable that is causing the problem. Therefore, the only real solution (beyond just avoiding those variable names) is to change the built in function definition.


Technical Support Wolfram Research, Inc.

share|improve this answer
This is now fixed in version 9. I'll include an edit in the question if you don't mind. – Szabolcs Dec 3 '12 at 0:30

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.