algorithm to find relationship of two twitter users -
i have 6 degrees of kevin bacon type problem. lets have 2 twitter users , want figure out relationship each other through friends (i use friends denote when follow vs them following you) , followers in twitter. have id's in database.
so example:
joel , sally
joel follows fred friends steve follows sally.
there multiple ways there, want shortest.
this seems known computer science problem (shortest path algorihm).
today have table called "influencers" twitter ids stored, have followings table self referential table (ids of followers on 1 side , friends on other.)
so graph theory? if can point me utilities/libraries/approaches can helpful. im using ruby, can parse languages.
as have said, known problem, can see in wikipedia.
just notice in case, weights in edges equal 1), don't think djikstra's algorithm useful you.
in order find minimum distance, suggest breadth-first search. problem twitter network may extremelly connected , hence may have combinatorial explosion (imagine each person connected 20 other persons - in first level, visit 20 profiles, while in next visit 400, , in next 8000 - if don't find sally fast, run out of memory).
there linear programming formulation, not 100% familiar. these notes on linear programming, not on shortest path problem, while these seem more focused on applications.
there video lecture on problem available on line seem quite complete.
i hope these references help.
Comments
Post a Comment