igraph-help
[Top][All Lists]

## Re: [igraph] a question about "similarity.invlogweighted()"

 From: Tamás Nepusz Subject: Re: [igraph] a question about "similarity.invlogweighted()" Date: Mon, 23 Sep 2013 13:44:15 +0200

```Hi,

Yes, there is a discrepancy between the behaviour of
similarity.invlogweighted() and the remaining similarity functions. Hopefully
this will be fixed in the next release.

> But I tried to calculate the similarity in a subset of nodes(with m nodes) in
> my network(with totally n nodes).
> Instead of a m*m matrix, I got a m*n matrix. How could I get the value for
> the selected nodes(selected by their names)?
Well, if you know the IDs of the nodes, you can simply select the required
columns from the result matrix based on the node IDs. If you don't know the
IDs, you can find them out using which() and the name vector (V(g)\$name).

> BTW, if a function return a matrix, then the value of matrix[i,j] is the
> result for the nodes with id "i" and "j", right?
Only if the matrix has as many rows and columns as the number of vertices.

similarity.jaccard() and similarity.dice() return an m*m matrix if you specify
m input vertices; in this case, row i and column j in the matrix corresponds to
the ith and jth vertex among the input vertices that you specified.

similarity.invlogweighted() returns an m*n matrix for m input vertices; in this
case, row i corresponds to the ith input vertex and column j corresponds to the
vertex with ID=j in the graph.

--
T.

```

reply via email to