Coder Social home page Coder Social logo

dirmeier / diffusr Goto Github PK

View Code? Open in Web Editor NEW
21.0 2.0 6.0 500 KB

Network diffusion algorithms in R.

License: GNU General Public License v3.0

R 47.59% C++ 52.02% C 0.38%
network-diffusion network-propagation markov-chain markov-random-walk nearest-neighbors heat-transfer r

diffusr's Introduction

diffusr

Project Status Build Status AppVeyor Build Status codecov CRAN Downloads

Network diffusion algorithms in R.

Introduction

diffusr implements several algorithms for network diffusion such as Markov random walks with restarts and weighted neighbor classification. Network diffusion has been studied extensively in bioinformatics, e.g. in the field of cancer gene prioritization. Network diffusion algorithms generally spread information, e.g. encoded as node weights, along the edges of a graph to other nodes. These weights can for example be interpreted as temperature, an initial amount of water, the activation of neurons in the brain, or the location of a random surfer in the internet. The information (node weights) is iteratively propagated to other nodes until a equilibrium state or stop criterion occurs.

Installation

Install diffusr using:

install.packages("diffusr")

Alternatively use the latest version from github:

devtools::install_github("dirmeier/diffusr")

Usage

Load the package using library(diffusr). We provide a vignette for the package that can be called using: vignette("diffusr"). Basically that is all you have to know.

Author

diffusr's People

Contributors

dirmeier avatar

Stargazers

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

Watchers

 avatar  avatar

diffusr's Issues

Support for igraph or sparse matrix?

Thank you for the development of such a valuable tool.
I am wondering if the 'graph' used in the random walk could be supported by using an object of igraph package or spare matrix? I think it would be a great benefit for a large background network.

Rcpp name exportation does not work with R-style function names

// [[Rcpp::interfaces(r, cpp)]]
// [[Rcpp::export(name=".as")]]
Rcpp::List neighbors_(const Rcpp::IntegerVector& node_idxs,
                      const Rcpp::NumericMatrix& W,
                      const int k)
{
...;
 }

This gives an error when registering routines. I guess this cannot be circumvented but to change the exported name.

Rcpp docu

roxygen/rcpp does not provide commentation when export name is set

Heat kernel

implement the heat kernel for th diffusion

Quiet option in `random.walk`, etc.

Hello,

Thank you for providing this package. Can you please add a quiet option in the diffusion functions to prevent text printing to the console? I am running permutations and getting thousands of lines of "normalizing column vectors!".

Thank you,
Josh Cook

When is is.ergodic tested?

Hello,
Thank you for making this package, it has been incredibly useful! I have run into a problem where some graphs will fail with the following message when using random.walk.

Error in random.walk(P0, adjM, r = restart_prob) :
  the provided graph has more than one component. It is likely not ergodic.

I found this error message in a method for random.walk in "R/mrw.R":

if(!.is.ergodic(stoch.graph))
      stop(paste("the provided graph has more than one component.",
                 "It is likely not ergodic."))

The graph that failed really was composed of multiple components, but so were all of my other graphs prior that ran without fail. I also tested each one on the .is.ergodic function in "R/mat_util.R" (after applying the normalize.stochastic and they all failed (ie. return FALSE).

Finally, I looked at the class of P0 and adjM, and they are both "matrix" in all cases that work and those that fail.

My OOP in R is poor, so I am unable to determine when the .is.ergodic test is being applied and when it isn't on a call to random.walk. Would you know a way for me to start troubleshooting this? If I can create a reprex, I'll add it in another post.

Thank you,
Josh Cook

undirected or directed? weighted or unweighted?

great and neat work!

this is definitely a naive question. but i could not find clear answers from the docs.
so just to make sure i use it correctly.
the input network for random.walk or heat.diffusion, does it have to be undirected or directed? are the edges weighted or unweighted?
thanks.

Modify s3 methods

Use

    method.matrix <- function(...)
    method.numeric <- function(...)

instead of checking the class in the method

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.