unum-cloud/ustore

Bug: ambiguous results for degree for self-loops in `ukv.graph`

alexbarev opened this issue · 1 comments

Describe the bug

The following snippet shows some inconsistency in ukv.graph between results for self-loop in .degree[] and .degree(). First return 2 * w(i, i), but second w(i, i) . NetworkX in both cases return double weight.

Steps to reproduce

import ukv.umem as ukv
import networkx as nx

db = ukv.DataBase()
graph = ukv.Network(db, 'graph', 'nodes', 'edges')
graph.add_edge(1, 1, 0)

print(graph.degree[1]
# 2
print(dict(graph.degree()))
# {1 : 1}

G = nx.Graph()
G.add_edge(1, 1)
print(G.degree[1])
# 2
print(dict(G.degree()))
# {1: 2}

Expected behavior

degree counts self-loop's weight with factor 2 in both cases.

UKV version

v0.7.4

Operating System

Ubuntu 22.04.1

Hardware architecture

x86

Are you using an embedded version?

  • I use the embedded version

Which interface are you using?

Official Python bindings

Which engine are you using?

UMem

Contact Details

No response

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct

  • I agree to follow this project's Code of Conduct