Note that there are some explanatory texts on larger screens.

plurals
  1. PONetworkx breaks Python?
    primarykey
    data
    text
    <p>I'm using networkx in Python (2.7.3 on OpenSuse 12.3) to analyse some large graphs. After decomposing my big network (9800 nodes, 6273292 edges) and then running the networkx <code>connected_components_subgraph(GRAPH)</code> function Python is no longer to make calls to the shell via <code>os.system()</code> (I haven't tested other shell-communication techniques like <code>subprocess</code> yet).</p> <p>The function itself runs without a hitch, and I get decomposed graphs which I can then manipulate no problem.</p> <p>See below for code example</p> <pre><code># this function is just included for completeness, but runs fine # ------------------------------------------------------------------------- import networkx as nx import os def build_network(filename): with open(filename) as f: content = f.readlines() GRAPH=nx.Graph() for connection in content: GRAPH.add_edge(connection.split("\t")[0], connection.split("\t")[1][:-1]) return GRAPH #-------------------------------------------------------------------------- ## CODE FROM HERE GRAPH = build_network("mtrx_large.abc") os.system("ls") # runs fine subgraphs = nx.connected_component_subgraphs(GRAPH) os.system("ls") # gives a -1 error - no os.system(&lt;&gt;) commands can run now </code></pre> <p>I am entirely stumped, and this throws up a pretty significant roadblock. This behaviour occurs in both <code>ipython</code> and through the standard Python interpreter. In ipython running <code>ls</code> directly now just returns nothing, but if I use <code>cd</code> it can actually autocomplete the directories.</p> <p><strong>UPDATE</strong></p> <p>This behaviour is <em>not</em> reproducible on my Ubuntu box (12.04), so seems to be specific to either OpenSuse or (more likely) my workstation. My Ubuntu box only has 8GBs of RAM, meaning after loading the graph and carrying out the connected subcomponents operation only 700MBs are free, which makes me think it's probably not a (straightforward) memory issue on the OpenSuse machine.</p> <p><strong>UPDATE 2</strong></p> <p>So I actually just <em>did</em> reproduce it on my Ubuntu box, which is VERY odd, but now I'm unable to reproduce it again, even after reaching a memory error. If anyone wants to try, the matrix file can be found <a href="https://dl.dropboxusercontent.com/u/5423228/mtrx_large.abc" rel="nofollow">here (72MBs) - I suggested using <code>Save as...</code> </a>. To run simply <code>cd</code> to the directory with this file in it and execute the code I've pasted above. You'll need <code>networkx</code> installed (obviously).</p> <p><strong>UPDATE 3</strong></p> <p>After rebooting my OpenSuse system and running over <code>ssh</code> I am able to successfully run the code. Still unsure what the issue could be - maybe something related to the fact that before reboot I had about a 1GB of used swap space?</p> <p><strong>UPDATE 4</strong></p> <p>Turns out the swap issue does not seem to be relevant (even when no swap space is used error can be reproduced). This is annoying - currently only rebooting helps.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload