Add required files for a github_install main
authorBenjamin Auder <benjamin.auder@somewhere>
Wed, 15 Jan 2025 21:38:36 +0000 (22:38 +0100)
committerBenjamin Auder <benjamin.auder@somewhere>
Wed, 15 Jan 2025 21:38:36 +0000 (22:38 +0100)
.gitignore
DESCRIPTION
LICENSE
NAMESPACE [new file with mode: 0644]
R/RcppExports.R [new file with mode: 0644]
README.md
man/ectd.Rd [new file with mode: 0644]
man/nng.Rd [new file with mode: 0644]
src/RcppExports.cpp [new file with mode: 0644]

index b07def6..4905182 100644 (file)
@@ -1,8 +1,3 @@
-/NAMESPACE
-/man/*
-!/man/nngd-package.Rd
-/R/RcppExports.R
-/src/RcppExports.cpp
 /src/*.o
 /src/*.so
 .RData
 /src/*.o
 /src/*.so
 .RData
index e882735..7cabf2d 100644 (file)
@@ -1,8 +1,9 @@
+Encoding: UTF-8
 Package: nngd
 Type: Package
 Title: Compute distances based on the nearest-neighbors graph.
 Package: nngd
 Type: Package
 Title: Compute distances based on the nearest-neighbors graph.
-Version: 1.0
-Date: 2021-12-06
+Version: 1.0.1
+Date: 2025-01-16
 Author: Benjamin Auder <benjamin.auder@universite-paris-saclay.fr> [aut,cre]
 Maintainer: Benjamin Auder <benjamin.auder@universite-paris-saclay.fr>
 Description: Only two functions for now. nng() builds the nearest-neighbors graph,
 Author: Benjamin Auder <benjamin.auder@universite-paris-saclay.fr> [aut,cre]
 Maintainer: Benjamin Auder <benjamin.auder@universite-paris-saclay.fr>
 Description: Only two functions for now. nng() builds the nearest-neighbors graph,
@@ -11,4 +12,4 @@ Description: Only two functions for now. nng() builds the nearest-neighbors grap
 License: MIT + file LICENSE
 Imports: Rcpp, RcppEigen, igraph, pracma
 LinkingTo: Rcpp, RcppEigen
 License: MIT + file LICENSE
 Imports: Rcpp, RcppEigen, igraph, pracma
 LinkingTo: Rcpp, RcppEigen
-RoxygenNote: 7.1.2
+RoxygenNote: 7.3.2
diff --git a/LICENSE b/LICENSE
index 9f4ff56..cebe631 100644 (file)
--- a/LICENSE
+++ b/LICENSE
@@ -1,2 +1,2 @@
-YEAR: 2021-2021
+YEAR: 2021-2025
 COPYRIGHT HOLDER: Benjamin Auder
 COPYRIGHT HOLDER: Benjamin Auder
diff --git a/NAMESPACE b/NAMESPACE
new file mode 100644 (file)
index 0000000..6c7d3a6
--- /dev/null
+++ b/NAMESPACE
@@ -0,0 +1,12 @@
+# Generated by roxygen2: do not edit by hand
+
+export(ectd)
+export(nng)
+import(Rcpp)
+importFrom(igraph,as_edgelist)
+importFrom(igraph,components)
+importFrom(igraph,graph_from_edgelist)
+importFrom(igraph,is_directed)
+importFrom(igraph,vcount)
+importFrom(pracma,pinv)
+useDynLib(nngd, .registration = TRUE)
diff --git a/R/RcppExports.R b/R/RcppExports.R
new file mode 100644 (file)
index 0000000..7b45931
--- /dev/null
@@ -0,0 +1,7 @@
+# Generated by using Rcpp::compileAttributes() -> do not edit by hand
+# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
+
+findNeighbors <- function(data, k, mutual) {
+    .Call(`_nngd_findNeighbors`, data, k, mutual)
+}
+
index 7f7947a..95e9883 100644 (file)
--- a/README.md
+++ b/README.md
@@ -9,7 +9,6 @@ wget https://raw.githubusercontent.com/Rookfighter/knn-cpp/master/include/knncpp
 
 ## Usage
 
 
 ## Usage
 
-roxygenize(".") <br>
 R CMD INSTALL . <br>
 library(nngd) <br>
 ?nng <br>
 R CMD INSTALL . <br>
 library(nngd) <br>
 ?nng <br>
diff --git a/man/ectd.Rd b/man/ectd.Rd
new file mode 100644 (file)
index 0000000..3d9e74d
--- /dev/null
@@ -0,0 +1,21 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/ectd.R
+\name{ectd}
+\alias{ectd}
+\title{Compute the Euclidian Commute-Time Distances (ECTD) in an undirected graph.}
+\usage{
+ectd(o, similarity = function(x) 1, inf.replace = TRUE)
+}
+\arguments{
+\item{o}{Output of \code{nng}.}
+
+\item{similarity}{function distance --> similarity.}
+
+\item{inf.replace}{Replace Inf values by large finite number ?}
+}
+\value{
+A distances matrix (n x n)
+}
+\description{
+Assuming similarity function doesn't depend on x, and undirected graph.
+}
diff --git a/man/nng.Rd b/man/nng.Rd
new file mode 100644 (file)
index 0000000..40ea7f7
--- /dev/null
@@ -0,0 +1,21 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/nng.R
+\name{nng}
+\alias{nng}
+\title{Compute the nearest-neighbors graph + pairwise distances.}
+\usage{
+nng(data, k = ceil(sqrt(nrow(data))), mutual = TRUE)
+}
+\arguments{
+\item{data}{data.frame or matrix.}
+
+\item{k}{Number of neighbors at each point.}
+
+\item{mutual}{Whether or not to build mutual kNN graph.}
+}
+\value{
+A list with $graph and $distances.
+}
+\description{
+This is just a wrapper around C++/Rcpp function.
+}
diff --git a/src/RcppExports.cpp b/src/RcppExports.cpp
new file mode 100644 (file)
index 0000000..01670fd
--- /dev/null
@@ -0,0 +1,36 @@
+// Generated by using Rcpp::compileAttributes() -> do not edit by hand
+// Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
+
+#include <RcppEigen.h>
+#include <Rcpp.h>
+
+using namespace Rcpp;
+
+#ifdef RCPP_USE_GLOBAL_ROSTREAM
+Rcpp::Rostream<true>&  Rcpp::Rcout = Rcpp::Rcpp_cout_get();
+Rcpp::Rostream<false>& Rcpp::Rcerr = Rcpp::Rcpp_cerr_get();
+#endif
+
+// findNeighbors
+List findNeighbors(NumericMatrix data, int k, bool mutual);
+RcppExport SEXP _nngd_findNeighbors(SEXP dataSEXP, SEXP kSEXP, SEXP mutualSEXP) {
+BEGIN_RCPP
+    Rcpp::RObject rcpp_result_gen;
+    Rcpp::RNGScope rcpp_rngScope_gen;
+    Rcpp::traits::input_parameter< NumericMatrix >::type data(dataSEXP);
+    Rcpp::traits::input_parameter< int >::type k(kSEXP);
+    Rcpp::traits::input_parameter< bool >::type mutual(mutualSEXP);
+    rcpp_result_gen = Rcpp::wrap(findNeighbors(data, k, mutual));
+    return rcpp_result_gen;
+END_RCPP
+}
+
+static const R_CallMethodDef CallEntries[] = {
+    {"_nngd_findNeighbors", (DL_FUNC) &_nngd_findNeighbors, 3},
+    {NULL, NULL, 0}
+};
+
+RcppExport void R_init_nngd(DllInfo *dll) {
+    R_registerRoutines(dll, NULL, CallEntries, NULL, NULL);
+    R_useDynamicSymbols(dll, FALSE);
+}