Skip to content

Commit

Permalink
Updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
randef1ned committed Jan 12, 2024
1 parent 337625b commit 7385e35
Show file tree
Hide file tree
Showing 19 changed files with 131 additions and 64 deletions.
4 changes: 4 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,7 @@ build-pkg*
.valgrindrc
^doc$
^Meta$
^_pkgdown\.yml$
^docs$
^pkgdown$
^\.github$
1 change: 1 addition & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.html
48 changes: 48 additions & 0 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
release:
types: [published]
workflow_dispatch:

name: pkgdown

jobs:
pkgdown:
runs-on: ubuntu-latest
# Only restrict concurrency for non-PR jobs
concurrency:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::pkgdown, local::.
needs: website

- name: Build site
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
shell: Rscript {0}

- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/[email protected]
with:
clean: false
branch: gh-pages
folder: docs
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,4 @@ src/*.dll
inst/doc
/doc/
/Meta/
docs
8 changes: 5 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ Type: Package
Title: Network Diffusion Algorithms
Version: 0.2.1
Date: 2018-04-20
Authors@R: person("Simon", "Dirmeier",
Authors@R: c(person("Simon", "Dirmeier",
email = "[email protected]",
role = c("aut", "cre"))
role = c("aut")),
person("Yinchun", "Su", email = "[email protected]", role = c("ctb", "cre")))
Maintainer: Simon Dirmeier <[email protected]>
Description: Implementation of network diffusion algorithms such as
heat diffusion or Markov random walks. Network diffusion algorithms generally
Expand All @@ -20,6 +21,7 @@ License: GPL (>=3)
Depends: R (>= 3.4)
LazyData: TRUE
LinkingTo: Rcpp, RcppEigen
biocViews: sparseMatrixStats
Imports:
Rcpp,
igraph,
Expand All @@ -34,7 +36,7 @@ Suggests:
lintr,
Matrix
VignetteBuilder: knitr
RoxygenNote: 7.2.3
RoxygenNote: 7.3.0
Encoding: UTF-8
Config/testthat/edition: 3
SystemRequirements: C++17
3 changes: 0 additions & 3 deletions R/diffusr-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@
#' @author Simon Dirmeier \email{simon.dirmeier@@gmx.de}
#' @name diffusr-package
#'
#' @docType package
#' @keywords package
#'
#' @references
#'
#' Tong, H., Faloutsos, C., & Pan, J. Y. (2006),
Expand Down
18 changes: 11 additions & 7 deletions R/heat_diffusion.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,17 @@
#' Graph diffusion using a heat diffusion process on a Laplacian matrix.
#'
#' @description An amount of starting heat gets distribution using the
#' Laplacian matrix of a graph. Every iteration (or time interval) \code{t}
#'heat streams from the starting nodes into surrounding nodes.
#' Laplacian matrix of a graph. Every iteration (or time interval) \eqn{t}
#' heat streams from the starting nodes into surrounding nodes.
#'
#' @export
#'
#' @param h0 an \code{n x p}-dimensional numeric non-negative vector/matrix
#' of starting temperatures
#' @param graph an (\code{n x n})-dimensional numeric non-negative adjacence
#' matrix representing the graph
#' @param h0 an \eqn{n \times p}-dimensional numeric non-negative
#' \code{\link[base]{matrix}} (or
#' \code{\link[Matrix:dgCMatrix-class]{dgCMatrix}},
#' \code{\link[base]{vector}}) of starting temperatures
#' @param graph an (\eqn{n \times n})-dimensional numeric non-negative
#' adjacence matrix representing the graph
#' @param t time point when heat is measured
#' @param ... additional parameters
#' @return returns the heat on every node as numeric vector
Expand All @@ -41,7 +43,9 @@
#' @importFrom Rcpp sourceCpp
#'
#' @references
#' \url{https://en.wikipedia.org/wiki/Laplacian_matrix} \cr
#'
#' \url{https://en.wikipedia.org/wiki/Laplacian_matrix}
#'
#' \url{https://en.wikipedia.org/wiki/Heat_equation}
#'
#' @examples
Expand Down
2 changes: 1 addition & 1 deletion R/is.dgCMatrix.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Check if a matrix is `dgCMatrix` class
#' Check if a matrix is \code{dgCMatrix} class
#'
#' @param mat The matrix to check
#'
Expand Down
7 changes: 3 additions & 4 deletions R/mat_util.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@
#' @export
#'
#' @param obj \code{\link[base]{matrix}} (or
#' \code{\link[Matrix:dgCMatrix-class]{dgCMatrix}}, \link[base]{vector}) that
#' is stochstically normalized
#' \code{\link[Matrix:dgCMatrix-class]{dgCMatrix}},
#' \code{\link[base]{vector}}) that is stochstically normalized
#' @param ... additional params
#' @return returns the normalized \code{\link[base]{matrix}} (or
#' \code{\link[Matrix:dgCMatrix-class]{dgCMatrix}}, \link[base]{vector})
#' @return returns the normalized matrix/vector)
#'
#' @importFrom checkmate assert check_matrix test_numeric test_atomic_vector
#'
Expand Down
21 changes: 11 additions & 10 deletions R/mrw.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@
#' Graph diffusion using a Markov random walk
#'
#' @description
#' A Markov Random Walk takes an inital distribution \code{p0}
#' A Markov Random Walk takes an inital distribution \eqn{p_0}
#' and calculates the stationary distribution of that.
#' The diffusion process is regulated by a restart probability \code{r} which
#' The diffusion process is regulated by a restart probability \eqn{r} which
#' controls how often the MRW jumps back to the initial values.
#'
#' @param p0 an \code{n x p}-dimensional numeric non-negative vector/matrix
#' @param p0 an \eqn{n \times p}-dimensional numeric non-negative vector/matrix
#' representing the starting distribution of the Markov chain
#' (does not need to sum to one).
#'
#' @param graph an (\code{n x n})-dimensional numeric non-negative adjacence
#' @param graph an \eqn{n \times p}-dimensional numeric non-negative adjacence
#' \code{\link[base]{matrix}} (or
#' \code{\link[Matrix:dgCMatrix-class]{dgCMatrix}}) representing the graph
#'
#' @param r a scalar between (0, 1). restart probability if a Markov random
#' walk with restart is desired
#' @param r a scalar between \eqn{(0, 1)}. restart probability if a Markov
#' random walk with restart is desired
#'
#' @param thresh threshold for breaking the iterative computation of the
#' stationary distribution. If the absolute difference of the distribution at
Expand All @@ -53,7 +53,8 @@
#' @param correct.for.hubs if \code{TRUE} multiplies a correction factor to the
#' nodes, such that the random walk gets not biased to nodes with high
#' degree. In that case the original input matrix will be normalized as:
#' \deqn{ P(j | i) = 1 /degree(i) * min(1, degree(j)/degree(j))}
#' \deqn{ P(j | i) = \dfrac{1}{\text{degree}(i)} \times
#' \min \left(1, \dfrac{\text{degree}(j)}{\text{degree}(i)}\right)}
#' \emph{Note that this will not consider edge weights.}
#'
#' @param allow.ergodic Allow multiple components in a graph.
Expand All @@ -62,9 +63,9 @@
#'
#' @return returns a list with the following elements
#' \itemize{
#' \item p.inf the stationary distribution as numeric vector
#' \item transition.matrix the column normalized transition matrix used for
#' the random walk
#' \item \code{p.inf} the stationary distribution as numeric vector
#' \item \code{transition.matrix} the column normalized transition matrix used
#' for the random walk
#' }
#'
#' @references
Expand Down
6 changes: 3 additions & 3 deletions R/neighbors.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#' @description
#' For every node in a set of nodes the graph gets traversed along the node's
#' shortest paths to its neighbors. Nearest neighbors are added until a maximum
#' depth of \code{k} is reached. For settings where there are more than \code{k}
#' depth of \eqn{k} is reached. For settings where there are more than \eqn{k}
#' neighbors having the same distance, all neighbors are returned.
#'
#' @export
Expand All @@ -33,8 +33,8 @@
#'
#' @param graph an (\eqn{n \times n})-dimensional numeric non-negative adjacence
#' \code{\link[base]{matrix}} (or
#' \code{\link[Matrix:dgCMatrix-class]{dgCMatrix}}, \link[base]{vector})
#' representing the graph
#' \code{\link[Matrix:dgCMatrix-class]{dgCMatrix}},
#' \code{\link[base]{vector}}) representing the graph
#'
#' @param k the depth of the nearest neighbor search, e.g. the depth of the
#' graph traversal
Expand Down
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ Before installation, we recommended you install Intel oneAPI Math Kernel Library
Windows users can download oneMKL from [Intel's website](https://www.intel.com/content/www/us/en/developer/tools/oneapi/onemkl-download.html) and install it in the default directory. The default directory is: `C:\Program Files (x86)\Intel\oneAPI`.

Debian users can download oneMKL using apt in the Debian non-free repo:
```{bash}

``` bash
# Install oneMKL version 2020.4.304-4
sudo apt install intel-mkl-full
```

Or using the Intel repo:
```{bash}

``` bash
# Set up the repository and signed the entry
wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \
| gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
Expand All @@ -38,7 +40,8 @@ sudo apt install intel-oneapi-mkl
```

Fedora users can download oneMKL by using dnf:
```{bash}

``` bash
# Create dnf repository file
tee > /tmp/oneAPI.repo << EOF
[oneAPI]
Expand All @@ -57,12 +60,14 @@ sudo dnf install intel-oneapi-mkl
## Installation

Install `diffusr` using:
```{r}

``` r
install.packages("diffusr")
```

Alternatively use the latest version from github:
```{r}

``` r
devtools::install_github("randef1ned/diffusr", build_vignettes = TRUE)
```

Expand Down
4 changes: 4 additions & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
url: https://diffusr.yinchun.su
template:
bootstrap: 5

2 changes: 0 additions & 2 deletions man/diffusr-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 10 additions & 7 deletions man/heat.diffusion.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/is.dgCMatrix.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions man/nearest.neighbors.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions man/normalize.stochastic.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 7385e35

Please sign in to comment.