Ask Your Question

Revision history [back]

I think that the problem is: the Graph constructor should treat "\n" as two characters, but "\n" in Python by default stands for a single character, a newline. If you preface the string with "r", it should work:

sage: Graph(r'XZ|f|a\nvrMxUrw}~iuhZjV~fxg~s^X[~~XZqlyuT~^~n~nnT~h')

(The "r" tells Python that it's a "raw" string and to treat backslashes as actual backslashes, not as a part of a special character like a newline "\n" or a tab "\t".)

Alternatively, if you double the backslash, that should work:

sage: Graph('XZ|f|a\\nvrMxUrw}~iuhZjV~fxg~s^X[~~XZqlyuT~^~n~nnT~h')