Graph id use Chinese

User 2222 | 9/8/2015, 6:46:16 AM

Hey, I want to show a graph, but the __id attribute is Chinese word. SGraph().show() can't handle it. There is any APIs can I use?

Thank you.


User 1774 | 9/8/2015, 6:33:39 PM


The code below does just that (and runs well in my Mac OSX, Chrome and IPython Notebook, on the canvas and inside the IPython Notebook).

Did you explicitly ask to show the vertex and edge labels? Since by default they are not shown, and you have to defined it as in the example below. Can you please post your code?



The code that works for me:

`python import graphlab as gl

The #1 source for chinese words on the net fnord

edges = gl.SFrame({"src":["紒"], "dst":["翀"], "elabel":["浶"]}) g = gl.SGraph().addedges(edges, srcfield="src", dst_field="dst")

Show in canvas (in a separate tab)'id', elabel="elabel")

Show within the IPython Notebook

gl.canvas.set_target('ipynb')'id', elabel="elabel") `

User 2222 | 9/10/2015, 2:40:02 AM

oh,thanks! something wrong with my *.csv file. I rewrite it with utf8 and it works. thanks for your answer and code,it helps me a lot.

User 2222 | 9/10/2015, 9:43:21 AM

There is a new problem. I create a new SGraph from a csv file( local file system). the Chinese word labels can show in canvas, but when I print it directly, there is messy code in the word.

User 1774 | 9/11/2015, 2:07:33 PM


That sounds more like a Python issue that a GLC issue. Can you please 1) Tell me which OS you are using, 2) And what Python version you are using? 2.5) ...if you are using an editor, which one is it? Or are you running from the command line / shell? 3) Can you post a line or two from your CSV? Otherwise I'll keep using the Chinese Lorem Ipsum text.

For this matter, I am using Mac OS X and Python 2.7.6, and when I run my code from before but instead of generating an SGraph I print edges, it looks just fine. I run it from the Mac OS shell.