vigna / webgraph-rs

A Rust port of the WebGraph framework
Apache License 2.0
32 stars 6 forks source link

outdegree() method #20

Closed vigna closed 1 year ago

vigna commented 1 year ago

We need an outdegree() method that returns the degree without expanding the compression data of a node.

In WebGraph, this is obtained by keeping a reader that is reused by the method. The result is that the structure is not thread safe and the whole LightweightPrototype mechanism. Thanks to the len() method for the successors() iterator I think we can turn page and keep the readers thread safe (and Send/Sync in Rust). The outdegree() method can clone a reader—it will be a bit heavy for the purpose, but outdegree() will be rarely used, if ever (and we can document this).