The algorithm of the interpersonal relationship of the circle of friends

Source: Internet
Author: User

Let's discuss it together! Shortest path?

1, once the network: the two sides are directly friends  2, two degrees of network: The two sides have more than one common friend, then the friend network can calculate you have a few common friends and present the number to you. Your relationship is: you, friends, and strangers  3, three-degree connections: that your friend's friend friend is this stranger. Your relationship is a friend---friends-------stranger  4, four-degree connections: More than three degrees increase once, your relationship is, you-friends---friends---friends----and strangers  5, five degrees of contacts: you-friends- > Friends---friends, friends, and strangers, like above this picture represents a five-degree relationship.  6, six-degree contacts: Friends---friends--friends---friend---friends----  according to six-degree network theory, the world of any two people between the contact interval of no more than 6 people. But I've seen two people spaced 7 people on my friend's website.     is such a simple picture, a simple function, in a few seconds to figure out your relationship with any one of the intervals between. But is it easy to implement? It's not easy, it's not easy at all. Jeffery today try to analyze the implementation algorithm behind Friends Network map.     first analyze the amount of computation required and the extent to which the user can accept it.   Users can accept the range, within 10 seconds, more than this time is too long.   The amount of arithmetic to be,  on average a person has 250 friends to count.   Calculate whether the number of times the network needs to compute, with your 250 friends to compare with the person's 250 friends, this need to compare the quantity is 250*250=62500, but also to add a counter, the cumulative you have a few common friends.     calculate whether the two-degree network requires the amount of computing, the server to scan your 250 direct friends of each 250 friends face with this person 250 friends to compare. Compare the following required   minimum calculation amount is: 250*250+1 = 62,501 times,  maximum operation is: 250*250*250=15625000 times//Two degrees people have reached the highest level of computing.     Three degrees the amount of computing that a network needs is the:  minimum operand is: 250*250*250+1=15,625,001 times   Maximum calculation is: 250*250*250*250= 3,906,250,000 playsApprox. 3.9 billion     four degrees the number of operations required by a network is the:  minimum operand: 250*250*250*250+1=3,906,250,001 times   Maximum calculation is: 250*250*250*250 *250=976,562,500,000 Times  //about 900 billion times.     five degrees the amount of computing that the network needs is the:  minimum calculation is: 250*250*250*250*250+1= 976,562,500,001 times   Maximum calculation is: 250*250*250*250*250*250=244,140,625,000,000  //about 240 trillion times     A six-degree network requires an operand that is:  the minimum operand is: 250*250*250*250*250*250+1=244,140,625,000,001   max operand is: 250*250*250*250*250*250* 250=61,035,156,250,000,000 Times  //about 600 million times what is the concept of  1,125,899,906,842,624 6 billion times, which means that each contrast operation as a byte storage, Requires a 54PB hard drive to store, and if it is a desktop with a 1TB hard drive, 5400 PCs are needed to store it.   Now it's a bit of a concept.   Such a huge amount of computing, to be in 10 seconds of the operation is a difficult problem, then the friend network is how in a few seconds to calculate the relationship between you and any two people, which in the end to use some of the algorithm?

https://q.cnblogs.com/q/36448/

The algorithm of the interpersonal relationship of the circle of friends

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.