Skip to content

Commit ec90ff7

Browse files
committed
- fixed a bug 509, where LoadEdgeListStr() failed with a mapping parameter
- updated bug list with latest reports
1 parent 9686002 commit ec90ff7

File tree

6 files changed

+19
-13
lines changed

6 files changed

+19
-13
lines changed

doc/source/reference/LoadEdgeListStr1.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Parameters:
2121
- *DstColId*: int (input)
2222
The column number in the file, which contains the node id representing the destination vertex.
2323

24-
- *StrToNIdH*: :class:`TStrIntH`, a hash table with string keys and int values (output)
24+
- *StrToNIdH*: :class:`TStrIntSH`, a string hash table with string keys and int values (output)
2525
Contains the mapping of strings to node ids.
2626

2727

@@ -35,5 +35,5 @@ The following example shows how to load the following from a text file, wiki-vot
3535

3636
import snap
3737

38-
mapping = snap.TStrIntH()
38+
mapping = snap.TStrIntSH()
3939
G0 = snap.LoadEdgeListStr(snap.PNGraph, "wiki-Vote.txt", 0, 1, mapping)

swig/snap.i

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ Version = "1.2.2"
366366
%template(TIntStrH) THash<TInt, TStr>;
367367
%template(TIntPrFltH) THash<TIntPr, TFlt>;
368368
%template(TStrIntH) THash<TStr, TInt>;
369+
%template(TStrIntSH) TStrHash<TInt, TStrPool, TDefaultHashFunc<TStr> >;
369370

370371
// define keydat types
371372
%template(TIntHI) THashKeyDatI <TInt, TInt>;
@@ -437,7 +438,6 @@ Version = "1.2.2"
437438
%template(TStrVStrH) THash<TStrV, TStr>;
438439
%template(TStrVStrVH) THash<TStrV, TStrV>;
439440
//%template(TStrSH) TStrHash<TInt>;
440-
//%template(TStrIntSH) TStrHash<TInt>;
441441
//%template(TStrToIntVSH) TStrHash<TIntV>;
442442

443443
// define keydat types

test/bug-509-load.py

Lines changed: 0 additions & 9 deletions
This file was deleted.
File renamed without changes.

test/test-509-load.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import snap
2+
3+
print "LoadEdgeListStr 1"
4+
G1 = snap.LoadEdgeListStr(snap.PUNGraph, "data/test-509.txt", 0, 1)
5+
print "nodes %d, edges %d" % (G1.GetNodes(), G1.GetEdges())
6+
7+
print "LoadEdgeListStr 2"
8+
#mapping = snap.TStrIntH()
9+
mapping = snap.TStrIntSH()
10+
G2 = snap.LoadEdgeListStr(snap.PUNGraph, "data/test-509.txt", 0, 1, mapping)
11+
print "nodes %d, edges %d" % (G2.GetNodes(), G2.GetEdges())
12+

test/test-snappy.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@
99

1010
# TODO
1111
# bug-328-cnm.py
12-
# bug-509-load.py
1312
# bug-585-genrndpowerlaw.py
1413
# bug-20150706-pagerank.py
14+
# bug-2015-18.py
15+
# bug-2015-130.py
16+
# bug-GetClosenessCentr.py
1517
scripts=(quick_test.py \
1618
cncom.py intro.py tutorial.py tneanet.py bfs.py attributes.py \
1719
test-tnodei.py test-io.py \
@@ -20,6 +22,7 @@ scripts=(quick_test.py \
2022
test-356-getei.py \
2123
test-374-addstrattrdate.py \
2224
test-384-deledge.py \
25+
test-509-load.py \
2326
test-582-getnodewcc.py \
2427
test-585-genrndpowerlaw.py \
2528
test-613-getbfstree.py \

0 commit comments

Comments
 (0)