Giter Site home page Giter Site logo

jinhongjung / pyrwr Goto Github PK

View Code? Open in Web Editor NEW
113.0 113.0 25.0 207 KB

Python Implementation for Random Walk with Restart (RWR)

License: MIT License

Python 100.00%
graph graph-mining network node-to-node-similarity pagerank personalized-node-ranking personalized-pagerank python3 random-walk-with-restart rwr

pyrwr's People

Contributors

jinhongjung avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

pyrwr's Issues

The shape of the input matrix should be n by n

In your code or function : "row_normalize()" as well as other functions, the shape of the function's input matrix should be the same in rows and columns. If the number of rows doesn't match up with that of its columns, we will get error from the function "np.dot()".

If the assumption is that "the matrix.shape[0] == matrix.shape[1]", then why bother to set:
m, n = self.A.shape ? It's really redundant and misleading.

I think that the code can be simplified.

unweighted RWR

I have tried to RWR without weight. However, in "utils/reader.py",  "weighted" is directly defined as True and so   even if my edges are unweighted,    "A = csr_matrix((np.ones(len(K), (I, J), shape=A.shape)))"  gives error due to lack of weight. I solved the problem by giving  them all same weight as default 1. In fact, it may be solved directly "utils/reader.py". weights argumant may be added as weights default True.

reader.txt

Error found when trying to execute rwr.read_graph(input_graph, graph_type)

I was trying to execute train_WGCN.py from this repository this error appeared. I execute the code through Anaconda environment.

My setup:

Operating System: Windows 10
Conda version: 4.10.3
Python version: 3.6.13

Using backend: pytorch
Traceback (most recent call last):
  File "train_WGCN.py", line 79, in <module>
    structural_info = compute_structural_infot(args.dataset, args.directed, args.dijkstra_k, args.in_out_ratio,args.restart_rate,args.in_out_peak)
  File "D:\Git\WGCN_Graph-Convolutional-Networks-with-Weighted-Structural-Features\utils_structural.py", line 50, in compute_structural_infot
    rwr.read_graph(input_graph, graph_type)
  File "E:\anaconda3\envs\wgcn\lib\site-packages\pyrwr-1.0.0-py3.6.egg\pyrwr\pyrwr.py", line 25, in read_graph
    self.A, self.base = reader.read_graph(input_path, graph_type)
  File "E:\anaconda3\envs\wgcn\lib\site-packages\pyrwr-1.0.0-py3.6.egg\utils\reader.py", line 77, in read_graph
    X = np.loadtxt(path, dtype=float, comments='#')
  File "E:\anaconda3\envs\wgcn\lib\site-packages\numpy\lib\npyio.py", line 968, in loadtxt
    fh = np.lib._datasource.open(fname, 'rt', encoding=encoding)
  File "E:\anaconda3\envs\wgcn\lib\site-packages\numpy\lib\_datasource.py", line 269, in open
    return ds.open(path, mode, encoding=encoding, newline=newline)
  File "E:\anaconda3\envs\wgcn\lib\site-packages\numpy\lib\_datasource.py", line 623, in open
    raise IOError("%s not found." % path)
OSError: data\cora_ml\out1_graph_edges_rwr.txt not found.

The error shows that rwr.read_graph(input_graph, graph_type) function is not successfully executed.

What might be the problem? Thanks in advance

the dimension of r doesn't match the number of nodes in PPI

I changed the network in the example to my network. I split it with Tab separator and saved it as txt file, which contains 17662 nodes, but the output r length is 101243544.Below is my code and txt file, could you please tell me where the problem is. Thank you so much!
code
test_ppi

Update requirements.txt

Hi,

I see that you hardcoded the package versions for requirements.txt. Have you tested on newer versions? I cannot downgrade to the package versions you suggest in my environment. It would be good to have compatibility with the latest versions of numpy and scipy.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.