Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
    • Help
    • Support
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
graph-tool
graph-tool
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Issues 44
    • Issues 44
    • List
    • Boards
    • Labels
    • Milestones
  • Merge Requests 1
    • Merge Requests 1
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Tiago Peixoto
  • graph-toolgraph-tool
  • Issues
  • #592

Closed
Open
Opened Jun 22, 2019 by Johannes Aengenheyster@jojoae
  • Report abuse
  • New issue
Report abuse New issue

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!

Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
0
Labels
None
Assign labels
  • View project labels
Reference: count0/graph-tool#592