# Is there really a bug in the following code, taken from the reference documentation for PetersenGraph?

PetersenGraph[5, 2, EdgeLabels -> {8 \[UndirectedEdge] 9 -> "hello"}]


appears to evaluate perfectly, as expected, but in my version 9.0.1.0, the option EdgeLabels -> {8 \[UndirectedEdge] 9 -> "hello"} is marked in red (as well as the preceding comma), as if it is a syntax error.

This happens for all predefined graphs I've tried so far.

Either this is an interface bug, or I've managed to mess up my syntax highlighting somehow. Can anyone confirm or deny this behaviour?

-

## 1 Answer

This seems to be a minor bug that shouldn't affect the functionality of PetersenGraph. The symbol has an incorrect SyntaxInformation. If it bothers you, you can (mostly) fix it by putting the following in your Kernel init.m:

If[\$Version == 9.0,

PetersenGraph; (* load symbol *)
Unprotect[PetersenGraph];
SyntaxInformation[PetersenGraph] = {"ArgumentsPattern"->{_.,_.,OptionsPattern[]}};
Protect[PetersenGraph];
]


After the first use of the function the red colouring will go away.

-
Does anyone know if there's a better way, avoiding the wrong colouring even before the first use? –  Szabolcs Dec 6 '13 at 18:49
@rm-rf If you do that, it's still coloured wrong before the first use. I think the problem is that the colouring is done by the front end, and the front end won't synchronize the colouring rules before the symbol has been used at least once (with the knowledge of the FE---which excludes a use in init.m) –  Szabolcs Dec 6 '13 at 18:55
That answers my question. I think I'll wait until the bugfix (presumably coming as bugs in documentation might be embarrassing?) as I'd probably end up fixing quite a lot of symbols; it isn't just the PetersenGraph that exhibits this bug. –  fairflow Dec 6 '13 at 19:06
@fairflow I'd rather hope for fixes for bugs that actually affect functionality ... this little thing I can live with. If you write to support at wolfram.com it's more likely that they'll fix it, provided there's a minor update to v9. I believe this to be already fixed in v10. –  Szabolcs Dec 6 '13 at 19:09