Similarity calculations with multiple edges between two vertices
Thanks for this great piece of software!
I've recently been playing around with data that has multiple edges between a pair of notes (for example, person and song), and I've come across some unexpected behavior.
When calculating the similarity between nodes, the values can differ based on the order the nodes are passed to the function, as well as surpass 1.
el = [["A", "v1"], ["A", "v1"], ["A", "v2"]]
gx = Graph(directed=False)
id_mp = gx.add_edge_list(el, hashed=True, string_vals=True)
vertex_similarity(gx, "dice", [(2,1)]) # 1.33
vertex_similarity(gx, "dice", [(1,2)]) # 0.66
(It seems to me that the node with the higher degree has to be the first argument to result in the correct score).
Another thing I noticed is that under some conditions nodes with different connection patterns (varying number of connections to the same set of notes) receive a similarity score of 1.
el2 = [["A", "v1"], ["A", "v1"], ["A", "v1"], ["B", "v1"], ["A", "v2"], ["B", "v2"], ["B", "v2"], ["B", "v2"]]
gx2 = Graph(directed=False)
id_mp = gx.add_edge_list(el2, hashed=True, string_vals=True)
vertex_similarity(gx2, "dice", [(1,3)]) # 1
While v1 and v2 are connected to the same set of notes, the first example shows that this does not necessarily result in a similarity score of 1.
I'm wondering, how much of this is intended behavior? Are similarity calculations maybe not intended to account for multiple edges between the same set of nodes? If so, is there another way to incorporate edge strength into similarity calculations?
Thanks!