LogoLogo
  • OpenRank
    • Ranking and Reputation
    • Use Cases
  • The Reputation Stack
    • Data
    • OpenRank Protocol
    • Apps and Clients
  • Integrations
    • Farcaster
      • Openrank Scores Onchain
      • Ranking Strategies on Farcaster
      • Global Profile Ranking
        • 🔵Top Profiles (based on Following)
        • 🔵Top Profiles (based on Engagement)
        • 🟢Profile Rank (based on Following)
        • 🟢Profile Rank (based on Engagement)
      • Channel User Rankings
        • 🔵Top Profiles in Channel
        • 🟢Profile Rank in Channel
      • Personalized Network
        • Direct Network
          • 🟢Get Direct Following
          • 🟢Get Direct Engagement
        • Extended Network
          • 🟢Personalized Following
          • 🟢Personalized Engagement
      • Frames
        • 🔵Top Frames
        • 🟢Personalized Recommended Frames
      • Feeds
        • For You Feed
          • 🔵For You
          • 🔵For You (by Authorship)
        • Channel Feed
          • 🔵Channel Trending Casts
      • Metadata
        • 🟢Get FIDs for Addresses
        • 🟢Get Handles For Addresses
        • 🟢Get Addresses for FIDs
        • 🟢Get Addresses for Handles
      • Ideas to Build using OpenRank APIs
      • Neynar x OpenRank Guides (WIP)
        • Build "For You" Feeds for your Client, using Neynar and OpenRank
        • Build "User Search" using Neynar and OpenRanks' Global Ranking API
        • Build "Suggested follow list" based on OpenRank and Neynar
        • Build Channel Trending Feeds for your Client using Neynar and OpenRank APIs
        • Build "Discover New Users Feed" using Neynar and OpenRanks Global Ranking API
        • Build Power Badges for your Client using Global & Personalized Ranking APIs by OpenRank
        • Build "Sort Replies" on a cast using Neynar and OpenRanks' Global Ranking API
    • Clanker OpenRank Scores
    • Lens Protocol
      • Ranking Strategies on Lens
      • Lens Profile APIs
      • Lens Content APIs
      • Lens Profile Insights
    • Metamask SPD
    • Onchain Graphs and Feeds
    • Upcoming Integrations
    • GitHub Developers & Repo Ranking
  • Reputation Algorithms
    • EigenTrust
    • Hubs and Authorities
    • Latent Semantic Analysis
  • OpenRank SDK
    • Introduction
    • Creating your first reputation graph
    • Publishing Rankings with OpenRank SDK
    • Guides
      • Tipping based User Rankings powered by OpenRank
    • Installation
    • SDK References
      • EigenTrust
        • Installation and Use
        • Examples for using EigenTrust
      • Hubs & Authorities
        • Installation and Use
        • Examples for using Hubs & Authorities (Coming soon)
      • Latent Semantic Analysis (Coming soon)
Powered by GitBook
LogoLogo

SOCIALS

  • Github
  • Farcaster

Copyright 2024

On this page
  • Introduction
  • Methods
  • run_and_publish_eigentrust
  • publish_eigentrust
  • Example
  1. OpenRank SDK

Publishing Rankings with OpenRank SDK

Publishing rankings after running the OpenRank SDK

Introduction

The OpenRank SDK allows you to compute and publish trust rankings using the EigenTrust algorithm. This document provides the documentation of the available methods, including description of the parameters and an example for quick reference.

The published urls can be found on -

http://openrank-sdk-api.k3l.io/download/eigentrust/{id}

Methods

run_and_publish_eigentrust

Description

Runs the EigenTrust algorithm using local trust and pre-trust data, and publishes the results.

Parameters

Name
Type
Description
Default

id_

str

The ID for publishing the results. (This will be used to query the published rankings)

-

localtrust

List[IJV]

List of local trust values. Each item is a dictionary with keys: i (source node), j (destination node), and v (trust value).

-

pretrust

List[IV]

List of pre-trust values. Each item is a dictionary with keys: i (node) and v (pre-trust value).

None

kwargs

dict

Additional keyword arguments.

-

overwrite

bool

If True, existing results with the same ID will be overwritten.

False

Returns

  • Tuple[List[Score], str]: A tuple containing:

    • List[Score]: List of computed scores.

    • str: URL of the published results.

publish_eigentrust

Description

Publishes the EigenTrust results.

Parameters

Name
Type
Description
Default

id_

str

The ID for publishing the results.

-

result

List[Score]

List of computed scores.

-

kwargs

dict

Additional keyword arguments.

-

overwrite

bool

If True, existing results with the same ID will be overwritten.

False

Returns

  • str: URL of the published results.

Example

from openrank_sdk import EigenTrust

# Initialize local trust data
localtrust = [
    {'i': 'Node1', 'j': 'Node2', 'v': 0.8},
    {'i': 'Node2', 'j': 'Node3', 'v': 0.6},
    {'i': 'Node3', 'j': 'Node1', 'v': 0.4},
]

# Initialize pre-trust data (optional)
pretrust = [{'i': 'Node1', 'v': 1.0}]

et = EigenTrust(api_key=api_key)

# Run the EigenTrust algorithm and publish the results
scores, publish_url = et.run_and_publish_eigentrust('my_results', localtrust, pretrust, overwrite=True)

# Output the results
print(f'Computed scores: {scores}')
print(f'Results published at: {publish_url}')
# http://openrank-sdk-api.k3l.io/download/eigentrust/my_results

# Publish EigenTrust results separately
url = et.publish_eigentrust('my_results2', scores, overwrite=True)
print(f'Results published at: {url}')
# http://openrank-sdk-api.k3l.io/download/eigentrust/my_results2
PreviousCreating your first reputation graphNextGuides

Last updated 9 months ago