Code Monkey home page Code Monkey logo

igraphmatch's Introduction

CRAN status R-CMD-check

iGraphMatch

iGraphMatch is a R package for graph matching. The package works for both igraph objects and matrix objects. You provide the adjacency matrices of two graphs and some other information you might know, choose the graph matching method, and it returns the graph matching results. iGraphMatch also provides a bunch of useful functions you might need during the process of graph matching.

Installation

# install.packages("devtools")
devtools::install_github("dpmcsuss/iGraphMatch")

This package is still in development. The dev branch of the package might be more stable. This can be installed via devtools with

# install.packages("devtools")
devtools::install_github("dpmcsuss/iGraphMatch", ref = "dev")

Usage

After installation, we recommend loading igraph first.

library(igraph)
library(iGraphMatch)

Documentation

Documentation can be found via the help in R and at https://dpmcsuss.github.io/iGraphMatch/.

Author and Contributors

The primary authors for the package are Vince Lyzinski, Zihuan Qiao, and Daniel Sussman.

Joshua Agterberg, Lujia Wang, and Yixin Kong also provided important contributions. We also want to thank all of our users, especially Youngser Park, for their feedback and patience as we continue to develop the package.

Support

This work was supported in part by grants from DARPA (FA8750-20-2-1001 and FA8750-18-0035) and from MIT Lincoln Labs.

igraphmatch's People

Contributors

dpmcsuss avatar jagterberg avatar lujia4170 avatar olivroy avatar yxkong92 avatar zihuanqiao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

igraphmatch's Issues

Fix build issues with Vignette

Notably, should probably include in the front matter

vignette: >
  %\VignetteIndexEntry{Vignette Title}
  %\VignetteEngine{knitr::rmarkdown}
  \usepackage[utf8]{inputenc}

We also need to make sure the correct package dependencies are going through.

lapmod cost matrix

Is this line correct?
https://github.com/dpmcsuss/iGraphMatch/blob/master/R/rlapjv.R#L64

The cost matrix transformation for lapjv looks like:

cost <- rbind(
  cbind(
    as.matrix(cost), 
    m + m * stats::runif(n)
  ),
  m + m * stats::runif(n + 1)
)

which adds a column to the left and a row to the bottom.

But the transformation for lapmod looks like:

cost <- rbind2(
  cbind2(
    cost, 
    sign * 1e5 * (m * ceiling(stats::runif(n))),
    c(pad_vec, - sign * 1e5 * m)
  )
)

which adds two columns to the left, and seems to call an rbind2 that doesn't do anything.

(I haven't yet dug into precisely what this transformation does, or the changes you made to lapmod, but figured I'd ask this first.)

match_report

Please add a parameter (e.g., "verbose") so that it can disable the console output!
Thanks!

splr Methods

splr indexing seems to fail when indexing a single row/column/entry.
This should return a vector

diag does not seem to compute correctly

Release iGraphMatch 2.0.2

Prepare for release:

  • git pull
  • Check current CRAN check results
  • Polish NEWS
  • usethis::use_github_links()
  • urlchecker::url_check()
  • devtools::check(remote = TRUE, manual = TRUE)
  • devtools::check_win_devel()
  • revdepcheck::revdep_check(num_workers = 4)
  • Update cran-comments.md
  • git push

Submit to CRAN:

  • usethis::use_version('patch')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted 🎉
  • usethis::use_github_release()
  • usethis::use_dev_version(push = TRUE)

"sample_correlated_gnp_pair" error

Error1: object 'C_R_igraph_correlated_pair_game' not found
Error2: object 'C_R_igraph_finalizer' not found
Already require(igraph) in the function

Can't install iGraphMatch

After trying to install via devtools, I get the following error:

Error: package or namespace load failed for ‘iGraphMatch’ in namespaceExport(ns, exports):
 undefined exports: get_perm, graph_match_IsoRank, graph_match_Umeyama
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/iGraphMatch’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/iGraphMatch’
Error in i.p(...) : 
  (converted from warning) installation of package ‘/var/folders/1j/1ft72mkd3cngwzhc1rs3l37m0000gs/T//RtmpTxFFkn/file1055e5f46d59/iGraphMatch_0.0.0.9000.tar.gz’ had non-zero exit status

Release iGraphMatch 2.0.0

Prepare for release:

  • Check current CRAN check results
  • Polish NEWS
  • urlchecker::url_check()
  • devtools::check(remote = TRUE, manual = TRUE)
  • devtools::check_win_devel()
  • rhub::check_for_cran()
  • rhub::check(platform = 'ubuntu-rchk')
  • rhub::check_with_sanitizers()
  • revdepcheck::revdep_check(num_workers = 4)
  • Update cran-comments.md
  • Review pkgdown reference index for, e.g., missing topics
  • Draft blog post

Submit to CRAN:

  • usethis::use_version('major')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted 🎉
  • usethis::use_github_release()
  • usethis::use_dev_version()
  • Finish blog post
  • Tweet
  • Add link to blog post in pkgdown news menu

cannot find "check_soft_seeds" function

I tried to run the example of "rds_sinkhorn_start" but it does not find the "check_soft_seeds" function. The information is as following:

rds_sinkhorn_start(nns=5, soft_seeds=as.data.frame(matrix(c(2,4,2,3),nrow=2)), distribution = "rnorm")
Error in rds_sinkhorn_start(nns = 5, soft_seeds = as.data.frame(matrix(c(2, :
could not find function "check_soft_seeds"

What I have tried: library(GraphMatch). check the R code in the package. I don't find the "check_soft_seeds" function code. Could you help me about this?

Needs revision ahead of Matrix 1.6-2 release

Matrix 1.6-2 defines additional methods for the %*% operator
that mask your four methods

     `%*%`(x=<matrix_list>, y=<ANY>)
     `%*%`(x=<ANY>, y=<matrix_list>)
     `%*%`(x=<graphMatch>, y=<ANY>)
     `%*%`(x=<ANY>, y=<graphMatch>)

where <ANY> inherits from virtual class Matrix. To ensure that your methods
continue to be dispatched, define four additional methods:


     `%*%`(x=<matrix_list>, y=<Matrix>)
     `%*%`(x=<Matrix>, y=<matrix_list>)
     `%*%`(x=<graphMatch>, y=<Matrix>)
     `%*%`(x=<Matrix>, y=<graphMatch>)

The new methods can be identical to the ones with <ANY> in the signature.

Please revise your package and test that it passes its checks under the latest
Matrix-devel, which you can install with

     install.packages("Matrix", repos = "http://r-forge.r-project.org/")

We anticipate releasing Matrix 1.6-2 in mid-October.

Add to Readme

Please add to README.md

  • How to install the package using devtools.
  • How to compile the package.

invalid class “splrMatrix” object: superclass "mMatrix" not defined in the environment of the object's class

Here is an error I'm getting with center_graph:

> A <- sample_correlated_gnp_pair(n = 10, corr = .5, p = .5)$graph1
> center_graph(A, scheme = "center")
Error in validObject(.Object) : 
  invalid class “splrMatrix” object: superclass "mMatrix" not defined in the environment of the object's class

and I got a similar error with gm:

> AB <- sample_correlated_gnp_pair(n = 10, corr = .5, p = .5)
> A = AB$graph1
> B = AB$graph2
> gm(A, B)
Error in validObject(.Object) : 
  invalid class “splrMatrix” object: superclass "mMatrix" not defined in the environment of the object's class

and this:

> gm(A, B, start='convex')
Error in validObject(.Object) : 
  invalid class “splrMatrix” object: superclass "mMatrix" not defined in the environment of the object's class

Maybe this is not directly related, but this option also gives an error:

> gm(A, B, start='rds_perm_bari')
Error in rds_perm_bari_start(nns, ns, soft_seeds, ...) : 
  unused arguments (A = new("dgCMatrix", i = c(2, 4, 5, 6, 9, 2, 3, 4, 5, 7, 8, 9, 0, 1, 3, 5, 6, 8, 1, 2, 4, 5, 6, 7, 0, 1, 3, 5, 8, 0, 1, 2, 3, 4, 6, 7, 9, 0, 2, 3, 5, 7, 1, 3, 5, 6, 8, 1, 2, 4, 7, 9, 0, 1, 5, 8), p = c(0, 5, 12, 18, 24, 29, 37, 42, 47, 52, 56), Dim = c(10, 10), Dimnames = list(NULL, NULL), x = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), factors = list()), B = new("dgCMatrix", 
    i = c(2, 4, 5, 7, 9, 2, 3, 4, 5, 7, 9, 0, 1, 3, 6, 7, 8, 1, 2, 6, 7, 9, 0, 1, 5, 6, 8, 9, 0, 1, 4, 6, 2, 3, 4, 5, 7, 9, 0, 1, 2, 3, 6, 9, 2, 4, 9, 0, 1, 3, 4, 6, 7, 8), p = c(0, 5, 11, 17, 22, 28, 32, 38, 44, 47, 54), Dim = c(10, 10), Dimnames = list(NULL, NULL), x = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), factors = list()))

Here is my R environment.

> sessionInfo()
R version 4.3.2 (2023-10-31)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Sonoma 14.2.1

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRblas.0.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: America/New_York
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] iGraphMatch_2.0.3

loaded via a namespace (and not attached):
 [1] compiler_4.3.2  magrittr_2.0.3  Matrix_1.6-5    cli_3.6.2       igraph_2.0.3   
 [6] glue_1.6.2      Rcpp_1.0.11     grid_4.3.2      lifecycle_1.0.4 pkgconfig_2.0.3
[11] rlang_1.1.2     lattice_0.22-5   

Can't install iGraphMatch package via master or dev branch

  1. I tried to install the iGraphMatch package via master or dev branch but there's a following error:
    Error : (converted from warning) /private/var/folders/0f/g_bjrzdd2qv38bwffzml_03m0000gn/T/RtmpYlURc0/R.INSTALL3747bca4b7d/iGraphMatch/man/center_graph.Rd:22: unknown macro '\hat'.

I think there might be a typo in center_graph document: A-\hat{Q}, where \hat{Q}. In dev_splr branch, it is written as A - Q, where Q is an approximate. Installing iGraphMatch package via dev_splr branch works.

  1. I think the development version of iGraphMatch package might require higher version of R. I can't install devtools package somehow under 3.3.2 version. After upgrading to the latest version, devtools package works. Do we need to mention it?

Release iGraphMatch 2.0.4

Prepare for release:

  • git pull
  • Check current CRAN check results
  • Polish NEWS
  • urlchecker::url_check()
  • devtools::check(remote = TRUE, manual = TRUE)
  • devtools::check_win_devel()
  • revdepcheck::revdep_check(num_workers = 4)
  • Update cran-comments.md
  • git push

Submit to CRAN:

  • usethis::use_version('patch')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted 🎉
  • usethis::use_github_release()
  • usethis::use_dev_version(push = TRUE)

Center Graph Enhancements

I understand that it makes the adjmat in [-1,1].
But, this assumes that the original adjmat is in [0,1], right?

Then, what if the original adjmat is not in [0,1]?
For example, my "unnormalized" weighted graph is on [0,57], and the center_graph changes it to [-1, 113] !?
I wonder if the center_graph on this graph is simply "no-effect" for matching or is there something more to it?
That is, I wonder if I need to rerun the matching without center_graph in this case?

Also, if your original intention of this function is to make all the graph in [-1,1], then 2*A[]-1 should be modified?

check_soft_seeds.R

Is this function going to be used for all seed checking? Check soft seeds seems to be the wrong name since the function is restricted to one-to-one seeds whereas for soft seeds we'll likely want many-to-many seeds as encoded in a doubly stochastic matrix or something.

Release iGraphMatch 2.0.1

Prepare for release:

  • git pull
  • Check current CRAN check results
  • Polish NEWS
  • urlchecker::url_check()
  • devtools::check(remote = TRUE, manual = TRUE)
  • devtools::check_win_devel()
  • rhub::check_for_cran()
  • rhub::check(platform = 'ubuntu-rchk')
  • rhub::check_with_sanitizers()
  • revdepcheck::revdep_check(num_workers = 4)
  • Update cran-comments.md
  • git push

Submit to CRAN:

  • usethis::use_version('patch')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted 🎉
  • git push
  • usethis::use_github_release()
  • usethis::use_dev_version()
  • git push

adpt_seeds_match.R

  • I'm not sure that "adaptive seeds" is the right word our adding seeds procedure.
  • Do we need separate functions such as graph_match_adpt_seeds and graph_match_soft_seeds. Again, I'm a bit sure about the naming for these. I think overall these might be too high level. I think these procedures would serve as great examples but they are in some ways too specific to be broadly useful.
  • Will the other functions, swap_order, fix_hard_D, ... be exported? Either way they should have some basic commenting.

Matrix 1.5

Matrix 1.5-5 will fix a number of bugs affecting subscripts of objects
inheriting from the virtual class 'Matrix'. Your package iGraphMatch
currently defines three methods

 [,matrix_list,ANY,missing,ANY
 [,matrix_list,missing,ANY,ANY
 [,matrix_list,missing,missing,ANY

that do

 xl[i, , drop]
 xl[, j, drop]
 xl[,  , drop]

where I can only assume that the author meant this

 xl[i, , drop = drop]
 xl[, j, drop = drop]
 xl[,  , drop = drop]

to ensure that the value of 'drop' is correctly matched to the formal
argument 'drop' and not the formal argument '...'. Matrix 1.5-5 will
make your current (incorrect) usage an error, so it must be changed.

Please correct and verify that your package passes its checks under the
development version of Matrix, which you can install with Subversion,
like so:

$ svn checkout svn://svn.r-forge.r-project.org/svnroot/matrix/pkg/Matrix
$ R CMD build Matrix
$ R CMD INSTALL Matrix_1.5-5.tar.gz

{
Note that installing in the usual way

 > install.packages("Matrix", repos = "http://r-forge.r-project.org/")

 seems to provide an outdated version of Matrix, due to a glitch
 in R-Forge, which I hope is just temporary ...

 If you do not have Subversion, then I can try to host a tarball on
 GitHub for you ...

}

We have not yet fixed a date for the release of Matrix 1.5-5 {as 1.5-4
was just released recently}. Still, we are trying to give maintainers
as much notice as possible about required changes.

Using 'rds_perm_bari` start with gm gives an error

> gm(A, B, start='rds_perm_bari')
Error in rds_perm_bari_start(nns, ns, soft_seeds, ...) : 
  unused arguments (A = new("dgCMatrix", i = c(2, 4, 5, 6, 9, 2, 3, 4, 5, 7, 8, 9, 0, 1, 3, 5, 6, 8, 1, 2, 4, 5, 6, 7, 0, 1, 3, 5, 8, 0, 1, 2, 3, 4, 6, 7, 9, 0, 2, 3, 5, 7, 1, 3, 5, 6, 8, 1, 2, 4, 7, 9, 0, 1, 5, 8), p = c(0, 5, 12, 18, 24, 29, 37, 42, 47, 52, 56), Dim = c(10, 10), Dimnames = list(NULL, NULL), x = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), factors = list()), B = new("dgCMatrix", 
    i = c(2, 4, 5, 7, 9, 2, 3, 4, 5, 7, 9, 0, 1, 3, 6, 7, 8, 1, 2, 6, 7, 9, 0, 1, 5, 6, 8, 9, 0, 1, 4, 6, 2, 3, 4, 5, 7, 9, 0, 1, 2, 3, 6, 9, 2, 4, 9, 0, 1, 3, 4, 6, 7, 8), p = c(0, 5, 11, 17, 22, 28, 32, 38, 44, 47, 54), Dim = c(10, 10), Dimnames = list(NULL, NULL), x = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), factors = list()))

Release iGraphMatch 2.0.3

Prepare for release:

  • git pull
  • Check current CRAN check results
  • Polish NEWS
  • urlchecker::url_check()
  • devtools::check(remote = TRUE, manual = TRUE)
  • devtools::check_win_devel()
  • revdepcheck::revdep_check(num_workers = 4)
  • Update cran-comments.md
  • git push

Submit to CRAN:

  • usethis::use_version('patch')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted 🎉
  • usethis::use_github_release()
  • usethis::use_dev_version(push = TRUE)

install_github

Error: Installation failed: Not Found (404)
Is this because dpmcsuss/iGraphMatch is a private repository?

Release iGraphMatch 2.0.5

Prepare for release:

  • git pull
  • Check current CRAN check results
  • Polish NEWS
  • urlchecker::url_check()
  • devtools::check(remote = TRUE, manual = TRUE)
  • devtools::check_win_devel()
  • revdepcheck::revdep_check(num_workers = 4)
  • Update cran-comments.md
  • git push

Submit to CRAN:

  • usethis::use_version('patch')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted 🎉
  • usethis::use_github_release()
  • usethis::use_dev_version(push = TRUE)

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.