# Ranking Strategies on Farcaster

## **Defining Ranking Strategies**

We have implemented a set of strategies that can reveal high quality (highly ranked) profiles from the entire Farcaster network. These ranking strategies are based on [**following**](#strategy-following) and [**engagement**](#strategy-engagement) reputation graphs.

## **How are the Rankings performed?**

We use Farcaster social graph data and use a linear combination of peer-to-peer actions such as Follows, Recasts, Mentions, Comments to calculate a personalized reputation graph for each user. This helps in figuring your own network or friends and friends of friends. We then apply EigenTrust on these graphs to generate a ranking of users.&#x20;

Developers can change the algorithm weights and the rankings change real-time based on the updated parameters.

{% hint style="info" %}
To see how this is done in our codebase, checkout the repo on our `farcaster-graph` [GitHub repo](https://github.com/Karma3Labs/farcaster-graph), specifically on [these lines of code](https://github.com/Karma3Labs/farcaster-graph/blob/main/pipeline/globaltrust/compute.py#L108-L118)
{% endhint %}

### Seeding the Rankings

For Ranking the entire set of Farcaster profiles (Global Ranking), we use a seed peer set of profiles. For Personalized Ranking, the seed peer is the profile(s) itself.

The Global Profile Ranking compute is seeded with a few profiles chosen as a starting point to begin the computation of transitive trust among profiles. This seed peer selection is upto the developers. But for simplicity, we have currently chosen a curated list of profiles using the Dune [Farcaster Explorer dashboard](https://dune.com/ilemi/farcaster-explorer).  The seed peers are the influencers and VIPs retrieved via this query on [Dune](https://dune.com/queries):

```sql
SELECT 
    fid, fname, fid_active_tier, 
    CASE 
        WHEN fid_active_tier = 3 THEN 'influencer' ELSE 'vip'
    END AS fid_active_tier_name
FROM
    query_3418402 
WHERE
    fid_active_tier in (3,4) 
LIMIT 100
```

as a result, these are the sample of the seed users loaded into a `pretrust` table (as seen in the [db\_schema.sql](https://github.com/Karma3Labs/farcaster-graph/blob/main/db_schema.sql#L340-L347))

<figure><img src="https://content.gitbook.com/content/EtcdATXDvC0WSePF1xED/blobs/1LvCJAgspu8sEaTZ3WzM/image.png" alt=""><figcaption><p>Sample Influencers and VIPs picked as seed trusted users for Profile Ranking using OpenRank</p></figcaption></figure>

### Strategy: **following**

This strategy emphasizes only on `following` as peer-to-peer trust heuristics, disregarding all other actions such as `likes`, `replies`, `recasts` and `mentions`. &#x20;

{% hint style="info" %}
***Weight Assignments:** Follows = 1*
{% endhint %}

You can see the weight assignments [here in the code](https://github.com/Karma3Labs/farcaster-graph/blob/main/pipeline/globaltrust/compute.py#L77-L83).

### Strategy: engagement

This strategy emphasizes on engagement actions as peer-to-peer trust heuristics, by combining `likes`, `replies`, `recasts`, `mentions` and `follows`.  The more engagement a profile receives on their casts, the more they inherit trustworthiness from the source profile, but weighted by the trustworthiness or reputation of the source as well.&#x20;

Therefore, if a set of sybil or spam clusters boost a particular profile (say Alice) and their casts, Alice's ranking will likely not increase because of the low rank of the profiles which are engaging with Alice.&#x20;

{% hint style="info" %}
***Weight Assignments:** Likes = 1, Replies = 6, Recasts = 3, Mentions = 12, Follows = 1*
{% endhint %}

You can see the weight assignments [here in the code](https://github.com/Karma3Labs/farcaster-graph/blob/main/pipeline/globaltrust/compute.py#L88-L93). Developers can also change the weights in the algorithms.&#x20;

Ranking Scope includes [Global](https://docs.openrank.com/integrations/farcaster/global-profile-ranking) and [Personalized](https://docs.openrank.com/integrations/farcaster/personalized-network), you can know more about them in their respective sections.

{% hint style="info" %}
Tryout the APIs here! — <https://graph.cast.k3l.io/docs#/>
{% endhint %}
