Ask Your Question
0

networkx beginner

asked 2013-08-24 05:59:44 -0500

Hi, I installed networkx package along with imagemagick( i am required to use it in my project). While going through the tutorial pdfs i got stuck at the second line. The first line [ import networkx as nx ] works fine but on executing the second line: [ G=nx.Graph() ], i get an error as:

bash: syntax error near unexpected token `('

Please help me in this regard. I am a complete newbie to networkx as well as python. Thank You.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2013-08-24 10:33:43 -0500

kcrisman gravatar image

Sage has Networkx built in as one of its backends for graphs. (Is this a Sage question?)

$ sage -python
Python 2.7.5 (default, Aug  1 2013, 18:11:00) 
[GCC 4.7.3] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import networkx as nx
>>> G = nx.Graph()
>>>

This should work fine, also in regular Python if you have the right things installed as you say. The "bash" in your error message indicates to me that you are not running Python (though I'm not sure how you got the first line to work in that case!).

If that's not the problem, can you give us an exact terminal output of what you did, in addition to what version of Sage you are using, etc.?

edit flag offensive delete link more

Comments

import is a command of the ImageMagick package, see manpages: ( import - saves any visible window on an X server and outputs it as an image file. You can capture a single window, the entire screen, or any rectangular portion of the screen.)

ndomes gravatar imagendomes ( 2013-08-25 02:15:55 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-08-24 05:59:44 -0500

Seen: 132 times

Last updated: Aug 24 '13