[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] a question about "similarity.invlogweighted()"
From: |
Qunawei Zhang |
Subject: |
Re: [igraph] a question about "similarity.invlogweighted()" |
Date: |
Mon, 23 Sep 2013 10:14:57 -0400 |
User-agent: |
Microsoft-MacOutlook/14.3.7.130812 |
Thank so much.
Then would you give me some suggestions on how to get the weighted
similarities between a m selected nodes set?
Suppose I want to calculate the similarities between the nodes with ids
{100,60,50,90}, if I set similarity.invlogweighted(graph,
vids=c(100,60,50,90)). Then the fist row is for the node with id 100?
I am trying to do it in the following way, do you think I am in a right
way?
(1) Firstly, give each node a number(from 0 to n-1) which is used as the
id of the nodes, and record the ids for the m nodes.
(2) After I get a m*n matrix from similarity.invlogweighted(), I get the
columns corresponding to the m nodes.
So another question is that, if I input the graph with the function
read.graph(file="graph_ids.txt",format="edge list"), will the numbers be
used as the ids, or new ids will be assigned according to the
sequence of the nodes? For example, if the first edge is "0, 100", will
the node "100" be assigned an id "1"?
BTW, would you please tell me where can I find the source code about
similarity.invlogweighted()?
Many thanks, and have a good day
Best
Quanwei
On 9/23/13 7:44 AM, "Tamás Nepusz" <address@hidden> wrote:
>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.
>_______________________________________________
>igraph-help mailing list
>address@hidden
>https://lists.nongnu.org/mailman/listinfo/igraph-help