birewire.similarity: Compute the Jaccard similarity index between two binary...

Description Usage Arguments Details Value Author(s) Examples

View source: R/BiRewire.R

Description

Compute the Jaccard similarity index between two binary matrices with the same number of non-null entries and the sam row- and column-wise sums. The function accept also two igraph objects.

Usage

1

Arguments

m1

First matrix or graph;

m2

Second matrix or graph.

Details

The Jaccard index between two sets M and N is defined as:

{|M \cup N|}/{|M \cap N |}

With M and N binary matrices, the Jaccard index is computed as:

\frac{∑ N_{i,j} \wedge M_{i,j}}{ ∑ N_{i,j} \vee M_{i,j}}.


The Jaccard index ranges between 0 and 1 and since 3.6.0 can be computed also among matrix with NAs.

Value

Returns the Jaccard similarity index between the objects.

Author(s)

Andrea Gobbi
Maintainer: Andrea Gobbi <gobbi.andrea@mail.com>

Examples

1
2
3
4
5
6
7
library(igraph)
library(BiRewire)
g <- graph.bipartite( rep(0:1,length=10), c(1:10))
g2=birewire.rewire.bipartite(g) 

birewire.similarity(get.incidence(g,sparse=FALSE),get.incidence(g2,sparse=FALSE))
birewire.similarity(g,g2)

BiRewire documentation built on Nov. 8, 2020, 8:09 p.m.