gabipurcaru / followgraph

MIT License
207 stars 22 forks source link

A sort-by-distinctiveness sort option? #3

Open kixiQu opened 1 year ago

kixiQu commented 1 year ago

I think it might be neat to have an option to sort by – if I'm understanding this right –

      return (b.followed_by.size / b.followers_count) - (a.followed_by.size/ a.followers_count)

or, for the lazy smoothing method recommended me by a college prof years ago for ratios like these,

    return ((b.followed_by.size + 1) / (b.followers_count + 1)) - ((a.followed_by.size + 1) / (a.followers_count + 1))

https://github.com/gabipurcaru/followgraph/blob/b39369d8a8c29ce9416149c52305ce0c11baba17/components/Content.tsx#L109-L114

The current sort is good for people who are looking for new content to fill their feeds – but I'm also interested in increasing the connectedness of my little neighborhood within the network. So knowing that 80% of someone's followers are people I follow makes me much more interested in that person than in, say, Pixelfed being very widely followed by all people who have been around for a long time on Fedi.

anyway I know this is not a very helpful feature request because I'm not touching any of the actual UI work that'd be necessary to make it real, so definitely feel free to ignore. Cheers on the tool in general, it's very neat!

nemobis commented 1 year ago

I agree: for example, there's very little value in telling me that 10 % of my follows are following @gargron@mastodon.social (especially now that such ultrapopular accounts get pushed to users all the time through various recommendation systems, cf. https://github.com/mastodon/mastodon/issues/18128 ), while it's very interesting to know there's an account with 75 followers 50 of which I already follow: Screenshot_20221226_152538

So in my opinion the second account should be listed before the first, or at least I'd like an option to do so. That would be achieved by either of kixiQu's proposals, or by dividing the number of following contacts by the square root of the total followers, or something like that.

fgregg commented 1 year ago

the code currently just checks the "following" endpoint for your direct follows. That endpoint returns data about the users that that user follows, including the followers_count. However, the data on followers_count at that endpoint can be quite out of date, so the distinctiveness proposals here will generally not work with the data the code is currently fetching.

the code could directly fetch the account information for the indirect follows, but that would be dramatically increase the number of networks calls.

fgregg commented 1 year ago

this code actually worked pretty well:

    const list = Array.from(indirectFollowMap.values())
      .filter((d) => d.followed_by.size > 3)
      .sort((a, b) => {
        return (
          (b.followed_by.size + 50) /
            (Math.max(b.followed_by.size, b.followers_count) + 50) -
          (a.followed_by.size + 50) /
            (Math.max(a.followed_by.size, a.followers_count) + 50)
        )
      })