Issue with PathGraph



Bug introduced in 8.0.0 and fixed in 9.0.0

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?


Posted 2012-06-03T03:33:36.457

Reputation: 10 287

1I can repro this one. Awful. – Dr. belisarius – 2012-06-03T04:59:09.540

Me too. Also, neither of these work either: PathGraph[{j, k, l}]; PathGraph[{v, w, x}] – Jagra – 2012-06-03T05:07:09.170


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

– rm -rf – 2012-06-03T05:21:09.230

1I emailed them. Waiting for reply. – becko – 2012-06-03T16:10:26.683

@becko Please share the reply when you get one. – Szabolcs – 2012-06-04T07:19:17.777

@Szabolcs Sure. See the answer. – becko – 2012-06-04T17:07:37.233



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.


Posted 2012-06-03T03:33:36.457

Reputation: 10 287

This is now fixed in version 9. I'll include an edit in the question if you don't mind. – Szabolcs – 2012-12-03T00:30:08.360