当前位置:网站首页>Neo4j realizes social recommendation (4)
Neo4j realizes social recommendation (4)
2022-06-09 09:29:00 【Great for the rest of my life】
Catalog
- Understanding graph database neo4j( One )
- Understanding graph database neo4j( Two )
- Understanding graph database neo4j( 3、 ... and )
Preface
In the first three chapters, we learned how to Create a label node as well as Connections And Set properties The operation of , In this article, we actually simulate... In our social software Friend recommendation 、 Pay close attention to And so on .
Let's consider the relationship of friends and node attributes before implementation , There are good friends between the characters , The relationship has attributes such as relationship type and establishment time
Realization
Create nodes
First create a few nodes for social user tags
create (n:SocialUser {
name:' Li Bai '}) return n;
create (n:SocialUser {
name:' Wang Lun '}) return n;
create (n:SocialUser {
name:' meng haoran '}) return n;
create (n:SocialUser {
name:' Du Fu '}) return n;
create (n:SocialUser {
name:' wang changling '}) return n;
create (n:SocialUser {
name:' he zhizhang '}) return n;
create (n:SocialUser {
name:' Gao Shi '}) return n;
create (n:SocialUser {
name:' Li Yangbing '}) return n;
create (n:SocialUser {
name:' Yuan Danqiu '}) return n;
create (n:SocialUser {
name:' Kong Chaofu '}) return n;
create (n:SocialUser {
name:' Cuichengfu '}) return n;
The above are all Li Bai's friends , So we don't need to filter the pointing relationship , Point directly to the label
match (a:SocialUser {
name:' Li Bai '}),(b:SocialUser)
where b.name <> ' Li Bai ' merge (a)-[:FRIEND]->(b)
return a,b
View results 
Next, create Dufu's friend , Like Li Bai 、 There is no need to create Gaoshi
create (n:SocialUser {
name:' Wang wei '}) return n;
create (n:SocialUser {
name:' Yan Wu '}) return n;
Establish a good friend relationship with Dufu
match (a:SocialUser {
name:' Du Fu '}),(b:SocialUser {
name:' Li Bai '}) merge (a)-[:FRIEND]->(b);
match (a:SocialUser {
name:' Du Fu '}),(b:SocialUser {
name:' Gao Shi '}) merge (a)-[:FRIEND]->(b);
match (a:SocialUser {
name:' Du Fu '}),(b:SocialUser {
name:' Wang wei '}) merge (a)-[:FRIEND]->(b);
match (a:SocialUser {
name:' Du Fu '}),(b:SocialUser {
name:' Yan Wu '}) merge (a)-[:FRIEND]->(b);

It can be seen from the manual that Gao Shi is a mutual friend of Li Bai and Dufu , If you add an element of me now , I know Li Bai and Dufu at the same time , Li Bai and Dufu Pay close attention to Among the people who found People I may know .
But in the process of formal and specific analysis, regions should be added 、 company 、 Gender 、 Preferences and other attributes to enhance the accuracy of the recommender .
边栏推荐
- ESP32学习笔记【WiFi网络篇】-01AP&STA
- 如何看待 Dapr、Layotto 这种多运行时架构?
- MySQL basic subquery exercise
- [redis learning 12] sentry mechanism of distributed cache, partitioned cluster
- 附十七章 網絡程序解讀限定文章
- WebRTC系列--计算帧率及帧间隔
- In depth analysis: what is the prospect of doing software testing at the age of 25?
- Do you want to explore MySQL not in indexing?
- Reroute the final chapter of riverpod in the state management of flutter
- MySQL uses while to batch insert data in stored procedures (performance difference between batch submission and single submission)
猜你喜欢
随机推荐
How to use alicloud CDN to cache static websites deployed on function computing
2022-2028 global online programming learning platform industry survey and trend analysis report
深度解析:二十五岁做软件测试前景怎么样?
English grammar_ adverb
C语言指针
three. JS learning notes (16) -- turbulent ocean
Esp32 learning notes [WiFi network] - 03tcp server server connection
【线性代数】线性无关与正交基和正交矩阵
微信小程序获取用户信息并更新
MySQL基础 查询语句
Codeworks round 797 (Div. 3) a~e problem solving record
了解图数据库neo4j(一)
Postman 接口压力测试
Advanced web service (VIII) base64decoder
Do you want to explore MySQL not in indexing?
neo4j实现社交推荐(五)
[matlab] [digital simulation] [1] linprog solving linear programming, standard type
Paper understanding [RL - exp replay] - an equivalence between loss functions and non uniform sampling in exp replay
将文件流(InputStream)写入文件 将上传文件MultipartFile写到文件
Attachment 17: limited articles on network program interpretation








