Creating your first reputation graph

This is a getting started guide that lets you create a set of rankings (trust graph) for a sample dataset provided

Overview

OpenRank SDK allows you to compute trust rankings among peer to peer interaction data using the EigenTrust algorithm as one of the available options. You'll need to provide local trust data.

Installation

First, install the OpenRank SDK:

pip install openrank-sdk

Sample Local Trust Data (Input)

Local trust represents trust relationships between peers:

codelocaltrust = [
    {"i": "alice", "j": "bob", "v": 100},
    {"i": "charlie", "j": "bob", "v": 100},
    {"i": "alice", "j": "charlie", "v": 75}
]

Alternatively, use a CSV file:

from,to,value
alice,bob,100
charlie,bob,100
alice,charlie,75

Running the EigenTrust Algorithm

To compute trust rankings, use the EigenTrust class:

from openrank_sdk import EigenTrust

api_key = 'your_api_key'
a = EigenTrust(api_key=api_key)

# Option A - Using local variables
a.run_eigentrust(localtrust)
a.run_eigentrust(localtrust, pretrust)

# Option B - Using CSV files
a.run_eigentrust_from_csv("./lt.csv")
a.run_eigentrust_from_csv("./lt.csv", "./pt.csv")

Example Output

The output will show the trust rankings:

pythonCopy code[
  {'i': 'Charlie', 'v': 0.485969387755102},
  {'i': 'Bob', 'v': 0.2933673469387755},
  {'i': 'Alice', 'v': 0.22066326530612243}
]

This introduction covers the basic steps to create a trust graph using OpenRank SDK.

Last updated

Logo

Copyright 2024