# 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="/files/SU6W3YadFc6HX3emOI88" 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](/integrations/farcaster/global-profile-ranking.md) and [Personalized](/integrations/farcaster/personalized-network.md), you can know more about them in their respective sections.

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.openrank.com/integrations/farcaster/ranking-strategies-on-farcaster.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
