Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
evanbiederstedt committed Apr 11, 2022
2 parents 2cc38c5 + 99d1ad0 commit 2f6e1b5
Show file tree
Hide file tree
Showing 663 changed files with 237,780 additions and 88 deletions.
12 changes: 6 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# Changelog

## [1.0.2] - 2022 March 3
* Modified the Makevars file to correctly add an rpath (Runpath Search Path) for Mac OS users with `install_name_tool`. From the manual, the command used is `-change old new` whereby this "Changes the dependent shared library install name old to new in the specified Mach-O binary. More than one of these options can be specified. If the Mach-O binary does not contain the old install name in a specified -change option the option is ignored."

## [1.0.3] - 2022 April 08
* Install rigraph directly in `/src`. Remove previous linking to `igraph` R package in Makevars.

## [1.0.2] - 2022 March 03
* Fixed Makevars to use `install_name_tool -change`.

## [1.0.1] - 2021 Dec 03
* Modified the Makevars to use SHLIB_EXT to account for both shared library extensions on Mac OS (either *.so or *dylib)

## [1.0.0] - 2021-11-19
* `leidenAlg` has gone through no major revisions in over a year. In order to avoid any confusion, this should be released with a major version.


## [0.1.1] - 2021-03-02

* Fixed issue with unweighted graph. In this case, we set all edge weights to 1.


## [0.1.0] - 2020-11-11

* Version published on CRAN: https://cran.r-project.org/web/packages/leidenAlg/index.html
* Tagged version on github released on 2 Jan 2021: https://github.com/kharchenkolab/leidenAlg/releases/tag/0.1.0
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ License: GPL-3
Copyright: See the file COPYRIGHTS for various leidenAlg copyright details
Encoding: UTF-8
LazyData: true
Depends: R (>= 3.5.0), Matrix, igraph
Depends: R (>= 3.5.0), Matrix
Imports:
graphics,
grDevices,
igraph,
Matrix.utils,
parallel,
Rcpp (>= 1.0.5),
Expand All @@ -21,7 +22,7 @@ Suggests:
pbapply,
testthat (>= 3.1.0)
LinkingTo: Rcpp, RcppArmadillo, RcppEigen
SystemRequirements: GNU make
SystemRequirements: C++11, GNU make (optional), libxml2 (optional), glpk (>= 4.57, optional)
RoxygenNote: 7.1.2
URL: https://github.com/kharchenkolab/leidenAlg
BugReports: https://github.com/kharchenkolab/leidenAlg/issues
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@

Implements the Leiden algorithm via an R interface

## Note: Leiden Algorithm now in igraph

Since [October 2020](https://github.com/igraph/rigraph/pull/399), the R package [igraph](https://cran.r-project.org/web/packages/igraph/) contains the function `cluster_leiden()` implemented by Vincent Traag ([@vtraag](https://github.com/vtraag)). The usage of this function is detailed in the igraph documentation [here](https://igraph.org/r/html/1.2.7/cluster_leiden.html). We recommend users use this function.
#### Note: cluster_leiden() now in igraph

Since [October 2020](https://github.com/igraph/rigraph/pull/399), the R package [igraph](https://cran.r-project.org/package=igraph) contains the function `cluster_leiden()` implemented by Vincent Traag ([@vtraag](https://github.com/vtraag)). The usage of this function is detailed in the igraph documentation [here](https://igraph.org/r/html/1.2.7/cluster_leiden.html). We recommend users use this function.

There is still no R package which entirely encompasses all of the functionality of the original Python/C++ implementation here from https://github.com/vtraag/leidenalg. We hope interested developers could use this package as a starting point for creating an R package which mirrors the full available functionality of the Python package. See [here](https://github.com/vtraag/leidenalg#usage) for details.

## Summary

Expand Down
22 changes: 11 additions & 11 deletions src/Makevars
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@

## include OpenMP

PKG_CXXFLAGS= -I"../inst/include" -I"./leidenalg/igraph-R" -I"./leidenalg/include" $(SHLIB_OPENMP_CXXFLAGS)
PKG_CXXFLAGS= -I"../inst/include" -I"./rigraph/include" -I"./leidenalg/include" $(SHLIB_OPENMP_CXXFLAGS)

PKGB_PATH=`echo 'library(igraph); cat(system.file("libs", package="igraph"))' \
| ${R_HOME}/bin/R --vanilla --slave`

PKG_CFLAGS = -pthread
PKG_CFLAGS += -I"./include" -I"../rigraph/include"
LDFLAGS += -lpthread

PKG_LIBS=-L/usr/lib/ -L"." -lpthread -lstdc++ -lleidenalg -lm `$(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()"` $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) $(SHLIB_OPENMP_CXXFLAGS) $(PKGB_PATH)/igraph$(SHLIB_EXT)


PKG_LIBS=-L/usr/lib/ -L"." -lpthread -lstdc++ -lleidenalg -lrigraph -lm `$(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()"` $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) $(SHLIB_OPENMP_CXXFLAGS)
CXX_STD = CXX11
MkInclude = $(R_HOME)/etc${R_ARCH}/Makeconf

#.PHONY: all sublibs

#OBJECTS = $(.cpp=.o)
SUBDIRS = leidenalg
SUBLIBS = leidenalg.a

IGRAPH_LIB = $(PKGB_PATH)/igraph$(SHLIB_EXT)
SUBDIRS = rigraph leidenalg
SUBLIBS = librigraph.a leidenalg.a

all: $(SHLIB)
if [ "$(OS)" != "Windows_NT" ] && [ `uname -s` = 'Darwin' ]; then install_name_tool -change 'igraph$(SHLIB_EXT)' $(PKGB_PATH)/igraph$(SHLIB_EXT) $(SHLIB); fi

all: $(SHLIB)

$(SHLIB): $(OBJECTS) sublibs
$(SHLIB): sublibs
sublibs: sublibraries

sublibraries:
Expand Down
26 changes: 10 additions & 16 deletions src/Makevars.win
Original file line number Diff line number Diff line change
@@ -1,34 +1,28 @@

## include OpenMP

# detect R_arch
rarch := $(shell echo 'Sys.getenv("R_ARCH")' | ${R_HOME}/bin/R --vanilla --slave)
PKG_CXXFLAGS= -I"../inst/include" -I"./rigraph/include" -I"./leidenalg/include" $(SHLIB_OPENMP_CXXFLAGS)

PKGB_PATH := $(shell echo 'library(igraph); cat(system.file("libs", package="igraph"))' | ${R_HOME}/bin/R --vanilla --slave)

PKG_CFLAGS = -pthread
PKG_CFLAGS += -I"./include" -I"../rigraph/include"
LDFLAGS += -lpthread

## note: the space in '[1] "/i386" ' is important...
## else, '[1] "/x64" '
ifeq ($(rarch),[1] "/i386" )
IGRAPH_LIB := $(PKGB_PATH)/i386/igraph.dll
else
IGRAPH_LIB := $(PKGB_PATH)/x64/igraph.dll
endif

PKG_CXXFLAGS=-I"../inst/include" -I"./leidenalg/igraph-R" -I"./leidenalg/include" $(SHLIB_OPENMP_CXXFLAGS)

PKG_LIBS=-L/usr/lib/ -L"." -lpthread -lstdc++ -lleidenalg -lm $(shell "${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" -e "Rcpp:::LdFlags()") $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) $(SHLIB_OPENMP_CXXFLAGS) $(IGRAPH_LIB)
PKG_LIBS=-L/usr/lib/ -L"." -lpthread -lstdc++ -lleidenalg -lrigraph -lm `$(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()"` $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) $(SHLIB_OPENMP_CXXFLAGS)
CXX_STD = CXX11
MkInclude = $(R_HOME)/etc${R_ARCH}/Makeconf

#.PHONY: all sublibs

#OBJECTS = $(.cpp=.o)
SUBDIRS = leidenalg
SUBLIBS = leidenalg.a
SUBDIRS = rigraph leidenalg
SUBLIBS = librigraph.a leidenalg.a


all: $(SHLIB)
$(SHLIB): $(OBJECTS) sublibs

$(SHLIB): sublibs
sublibs: sublibraries

sublibraries:
Expand Down
2 changes: 1 addition & 1 deletion src/leiden.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,4 @@ std::vector<size_t> find_partition(SEXP graph, std::vector<double>& edge_weights
//return(igraph_ecount(&g));

}


1 change: 1 addition & 0 deletions src/leidenalg/CPMVertexPartition.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "CPMVertexPartition.h"
#include "igraph.h"

CPMVertexPartition::CPMVertexPartition(Graph* graph,
vector<size_t> membership, double resolution_parameter) :
Expand Down
3 changes: 3 additions & 0 deletions src/leidenalg/GraphHelper.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#include "GraphHelper.h"

#include "igraph.h"


#ifdef DEBUG
using std::cerr;
using std::endl;
Expand Down
2 changes: 2 additions & 0 deletions src/leidenalg/LinearResolutionParameterVertexPartition.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#include "LinearResolutionParameterVertexPartition.h"
#include "igraph.h"


LinearResolutionParameterVertexPartition::LinearResolutionParameterVertexPartition(Graph* graph,
vector<size_t> membership, double resolution_parameter) :
Expand Down
2 changes: 1 addition & 1 deletion src/leidenalg/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
CXX ?= g++
PKG_CXXFLAGS = -O3 -std=c++11 -pthread -fPIC $(SHLIB_OPENMP_CXXFLAGS)
PKG_CXXFLAGS += -I"./include" -I"./igraph-R"
PKG_CXXFLAGS += -I"./include" -I"../rigraph/include"
LDFLAGS += -lpthread


Expand Down
2 changes: 1 addition & 1 deletion src/leidenalg/Makefile.win
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
CXX ?= g++
PKG_CXXFLAGS = -O3 -std=c++11 -pthread -fPIC $(SHLIB_OPENMP_CXXFLAGS)
PKG_CXXFLAGS += -I"./include" -I"./igraph-R"
PKG_CXXFLAGS += -I"./include" -I"../rigraph/include"
LDFLAGS += -lpthread


Expand Down
2 changes: 2 additions & 0 deletions src/leidenalg/ModularityVertexPartition.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "ModularityVertexPartition.h"

#include "igraph.h"

#ifdef DEBUG
#include <iostream>
using std::cerr;
Expand Down
2 changes: 2 additions & 0 deletions src/leidenalg/MutableVertexPartition.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "MutableVertexPartition.h"

#include "igraph.h"

#ifdef DEBUG
using std::cerr;
using std::endl;
Expand Down
2 changes: 2 additions & 0 deletions src/leidenalg/Optimiser.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#include "Optimiser.h"
#include "igraph.h"


/****************************************************************************
Create a new Optimiser object
Expand Down
2 changes: 2 additions & 0 deletions src/leidenalg/RBConfigurationVertexPartition.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#include "RBConfigurationVertexPartition.h"
#include "igraph.h"


RBConfigurationVertexPartition::RBConfigurationVertexPartition(Graph* graph,
vector<size_t> const& membership, double resolution_parameter) :
Expand Down
2 changes: 2 additions & 0 deletions src/leidenalg/RBERVertexPartition.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "RBERVertexPartition.h"

#include "igraph.h"

RBERVertexPartition::RBERVertexPartition(Graph* graph,
vector<size_t> const& membership, double resolution_parameter) :
LinearResolutionParameterVertexPartition(graph,
Expand Down
2 changes: 2 additions & 0 deletions src/leidenalg/ResolutionParameterVertexPartition.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#include "ResolutionParameterVertexPartition.h"
#include "igraph.h"


ResolutionParameterVertexPartition::ResolutionParameterVertexPartition(Graph* graph,
vector<size_t> membership, double resolution_parameter) :
Expand Down
2 changes: 2 additions & 0 deletions src/leidenalg/SignificanceVertexPartition.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "SignificanceVertexPartition.h"

#include "igraph.h"

#ifdef DEBUG
#include <iostream>
using std::cerr;
Expand Down
2 changes: 2 additions & 0 deletions src/leidenalg/SurpriseVertexPartition.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "SurpriseVertexPartition.h"

#include "igraph.h"

SurpriseVertexPartition::SurpriseVertexPartition(Graph* graph,
vector<size_t> const& membership) :
MutableVertexPartition(graph,
Expand Down
42 changes: 0 additions & 42 deletions src/leidenalg/igraph-R/igraph_export.h

This file was deleted.

1 change: 1 addition & 0 deletions src/leidenalg/include/CPMVertexPartition.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define CPMVERTEXPARTITION_H

#include <LinearResolutionParameterVertexPartition.h>
#include "igraph.h"

class CPMVertexPartition : public LinearResolutionParameterVertexPartition
{
Expand Down
4 changes: 3 additions & 1 deletion src/leidenalg/include/GraphHelper.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef GRAPHHELPER_INCLUDED
#define GRAPHHELPER_INCLUDED

#include <igraph.h>
#include "igraph.h"
#include <vector>
#include <set>
#include <exception>
Expand All @@ -13,6 +13,8 @@
using std::endl;
//#endif



class MutableVertexPartition;

using std::vector;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define LINEARRESOLUTIONPARAMETERVERTEXPARTITION_H

#include <ResolutionParameterVertexPartition.h>
#include "igraph.h"

class LinearResolutionParameterVertexPartition : public ResolutionParameterVertexPartition
{
Expand Down
2 changes: 2 additions & 0 deletions src/leidenalg/include/ModularityVertexPartition.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#define MODULARITYVERTEXPARTITION_H

#include <MutableVertexPartition.h>
#include "igraph.h"


class ModularityVertexPartition : public MutableVertexPartition
{
Expand Down
2 changes: 2 additions & 0 deletions src/leidenalg/include/MutableVertexPartition.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include <set>
#include <utility>
#include <algorithm>
#include "igraph.h"


using std::string;
using std::map;
Expand Down
3 changes: 3 additions & 0 deletions src/leidenalg/include/Optimiser.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
#include <set>
#include <map>

#include "igraph.h"


#include <iostream>
using std::cerr;
using std::endl;
Expand Down
3 changes: 3 additions & 0 deletions src/leidenalg/include/RBConfigurationVertexPartition.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

#include "LinearResolutionParameterVertexPartition.h"

#include "igraph.h"


class RBConfigurationVertexPartition : public LinearResolutionParameterVertexPartition
{
public:
Expand Down
2 changes: 2 additions & 0 deletions src/leidenalg/include/RBERVertexPartition.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

#include <LinearResolutionParameterVertexPartition.h>

#include "igraph.h"


class RBERVertexPartition : public LinearResolutionParameterVertexPartition
{
Expand Down
3 changes: 3 additions & 0 deletions src/leidenalg/include/ResolutionParameterVertexPartition.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

#include <MutableVertexPartition.h>

#include "igraph.h"


class ResolutionParameterVertexPartition : public MutableVertexPartition
{
public:
Expand Down
2 changes: 2 additions & 0 deletions src/leidenalg/include/SignificanceVertexPartition.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

#include <MutableVertexPartition.h>

#include "igraph.h"


class SignificanceVertexPartition : public MutableVertexPartition
{
Expand Down
Loading

0 comments on commit 2f6e1b5

Please sign in to comment.