oscoin / osrank-rs

A pre-alpha osrank implementation in Rust.
http://oscoin.io/
3 stars 3 forks source link

Allow calculation of weights on the fly #85

Closed adinapoli-mndc closed 5 years ago

adinapoli-mndc commented 5 years ago

In preparation for the incremental monte carlo algorithm, we would need a better model to work with a Graph. Currently we have this slightly artificial Normalised newtype wrapper which witnesses the fact we import the graph using an adjacency matrix and, as such, we normalise all the edges beforehand, and the final graph is created with a single outgoing edge for each pair of nodes (N1,N2).

Such representation is also problematic when it comes to #83, because the trustRank phase happens inside the GraphAlgorithm::execute and as such we cannot mutate the input Graph. This means we need to be able to calculate the weight for each edge dynamically as the graph evolves. In order to do so, at the very minimum we would need to store somewhere the total contributions for an account and on the edges the number of contributions (if any).

Another alternative would be to store everything in some kind of hashmap, and leave the EdgeData alone. More design & thinking is required.