birewire.similarity {BiRewire}R Documentation

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.

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

birewire.similarity( m1,m2)

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


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)


[Package BiRewire version 3.16.0 Index]