Skip to content

Commit

Permalink
fix bug so still works with uncompressed input files
Browse files Browse the repository at this point in the history
  • Loading branch information
stivalaa committed Mar 26, 2022
1 parent 3f45f99 commit 8cdacf0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion scripts/extractcERGM2subgraphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ def main():
finally:
os.remove(tmpfile)
else:
print simfile
G = snap.LoadPajek(snap.PNEANet, simfile)
assert(len(terms) == G.GetNodes())
for (i, node) in enumerate(G.Nodes()):
Expand All @@ -300,7 +301,10 @@ def main():
nodelist.append(node.GetId())
termdict[node.GetId()] = Gsubgraph.GetIntAttrDatN(node.GetId(), "term")

regxp = re.compile("_([0-9]*)[.]net.gz$")
if gz:
regxp = re.compile("_([0-9]*)[.]net.gz$")
else:
regxp = re.compile("_([0-9]*)[.]net$")
outfilename = regxp.sub("_cergm2_subgraph_\\1.net.gz", simfile)
termoutfilename = regxp.sub("_cergm2_subgraph_term_\\1.txt.gz", simfile)
print 'Writing simulated subgraph to ', outfilename
Expand Down

0 comments on commit 8cdacf0

Please sign in to comment.