ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 25 Aug 2013 09:15:55 +0200networkx beginnerhttps://ask.sagemath.org/question/10467/networkx-beginner/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.
Sat, 24 Aug 2013 12:59:44 +0200https://ask.sagemath.org/question/10467/networkx-beginner/Answer by kcrisman for <p>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: </p>
<p><strong>bash: syntax error near unexpected token `('</strong> </p>
<p>Please help me in this regard. I am a complete newbie to networkx as well as python. Thank You.</p>
https://ask.sagemath.org/question/10467/networkx-beginner/?answer=15375#post-id-15375Sage 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.?Sat, 24 Aug 2013 17:33:43 +0200https://ask.sagemath.org/question/10467/networkx-beginner/?answer=15375#post-id-15375Comment by ndomes for <p>Sage has Networkx built in as one of its backends for graphs. (Is this a Sage question?)</p>
<pre><code>$ 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()
>>>
</code></pre>
<p>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!). </p>
<p>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.?</p>
https://ask.sagemath.org/question/10467/networkx-beginner/?comment=17127#post-id-17127import 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.)
Sun, 25 Aug 2013 09:15:55 +0200https://ask.sagemath.org/question/10467/networkx-beginner/?comment=17127#post-id-17127