Second-Degree Friend Query System Using Recursive First-Degree Lookups
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Conventional friend relationship query services struggle to provide real-time updates for second-degree friends, as they often rely on offline calculations that consume significant machine resources and fail to efficiently manage large friend networks.
Innovation Solution
A system and method for second-degree friend querying that involves a processing server and a storage server, where first-degree friends are pre-stored, allowing for real-time querying of second-degree friends by recursively querying first-degree friends, thereby reducing resource consumption and enabling timely updates.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Speed
If second-degree friend relationships are calculated and stored offline in advance, then query speed is improved, but machine resources are consumed excessively and data cannot be updated in time
Solution Approach 1:
The patent pre-calculates and stores only first-degree friend relationships in the database, rather than pre-calculating second-degree relationships. This preliminary action prepares the necessary foundation data while avoiding excessive resource consumption, allowing second-degree relationships to be computed on-demand during queries.
Solution Approach 2:
The patent extracts the second-degree friend calculation from the offline pre-processing stage and moves it to the online query stage. Only first-degree relationships are stored in advance, while second-degree relationships are derived dynamically by querying first-degree friends of first-degree friends during the actual query operation.
2Reliability
If second-degree friend relationships are calculated offline and stored, then real-time updates are achieved, but storage space and machine resources are occupied
Solution Approach 1:
The patent extracts only the essential first-degree friend relationships from storage, removing the unnecessary second-degree relationship data. This reduction in stored data quantity frees up storage space while maintaining the ability to provide real-time updates through dynamic computation during queries.
Solution Approach 2:
Instead of storing pre-computed second-degree friend relationships, the system creates them temporarily during the query process by copying and combining first-degree relationship data. This approach avoids permanent storage of second-degree data while still providing accurate real-time results.
3Use of energy by moving object
If only first-degree friends are stored, then machine resources are reduced, but second-degree friend queries require multiple query steps
Solution Approach 1:
The patent maintains continuous useful action by implementing an efficient recursive query mechanism that seamlessly chains first-degree friend queries to obtain second-degree friends. The system continuously performs necessary queries without idle periods, and the optimized query structure minimizes the total time required for these sequential operations.
Solution Approach 2:
The patent changes the query parameter from directly stored second-degree relationships to dynamically computed relationships based on first-degree friends. This parameter change reduces storage requirements while the optimized query algorithm compensates for the additional computation steps, maintaining acceptable query performance.
Data Source
AI summary
The present disclosure discloses a second-degree friend query method. The method includes storing a first-degree friend of each account, querying for the first-degree friend after receiving a second-degree friend query command, and query the first-degree friend to obtain a second-degree friend. A storage module stores the first-degree friend relationships. The second-degree friend is obtained through a query according to the first-degree friend in real time. The present disclosure further discloses a second-degree friend query apparatus and system corresponding to the foregoing method and a storage medium. The system includes a processing server and a storage server. The storage server stores a first-degree friend for each account, and queries for and returns the first-degree friend at the request of the processing server. The processing server controls an entire query procedure, and obtains a second-degree friend after twice queries. Further, because the processing server can manage multiple storage servers, obtaining a friend relationship chain of multiple types in one query command is supported.


