snap-python
snap-python copied to clipboard
GetRndNI() is not wrapped like GetNI()
Just flagging an issue found while working on a recent CS224W homework. Consider the following code snippet:
net = snap.GenRndGnm(snap.PUNGraph, 5, 10)
firstNI = net.GetNI(0)
randomNI = net.GetRndNI()
print firstNI # prints snap.TUNGraphNodeI; proxy of <Swig Object of type 'TUNGraphNodeI *'
print randomNI # prints Swig Object of type 'TUNGraph::TNodeI *'
print firstNI.GetId() # prints 0
print randomNI.GetId() # raises exception: AttributeError: 'SwigPyObject' object has no attribute 'GetId'
Basically, it looks get GetRndNI() does not return a snap.TUNGraphNodeI object.
I think the change is simple, and needs to be done in this file: https://github.com/snap-stanford/snap-python/blob/2f2e41559150ca790548e3d10486128ed3d84a27/dev/swig-r/pungraph.i
Let me know if you agree. I'd be happy to send in a pull request. :)
I tried a simple wrapping and it did not work. It would be great, if you have a patch that works.