eigentrust 0.2.0

EigenTrust reputation algorithm: global trust scores for peer-to-peer networks and social graphs, with Sybil resistance
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! cargo run --example csv --features csv

use eigentrust::csv::Network;
use eigentrust::EigenTrustOptions;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let local_trust = "from,to,weight\nalice,bob,3\nalice,carol,1\nbob,carol,2\ncarol,alice,1\n";
    let pre_trust = "peer\nalice\n";

    let network = Network::from_csv(local_trust, pre_trust)?;
    let result = network.eigentrust(&EigenTrustOptions::default().with_alpha(0.2))?;

    for (name, score) in network.ranking(&result) {
        println!("{:<8} {:.4}", name, score);
    }
    Ok(())
}