Pycharm+Neo4j红楼梦人物关系图谱

欢迎来到我的主页~【蜡笔小新..】

本篇收录于专栏【Python】

如果对你有帮助,希望点赞收藏加关注啦~

目录

前言

neo4j基础知识

Pycharm及代码实现

 py2neo

 数据集获取

代码介绍


前言

Python实验课时,老师提到用知识图谱构建红楼梦的人物关系图,所以课后根据视频和博客的学习,初尝试用neo4j进行构建,也在学习如何用Python直接进行手撕关系图并可视化,但是目前效果不佳,后续构建好继续分享在专栏。

neo4j基础知识

neo4j.com进行数据库下载安装

使用命令行输入

neo4j.bat console

 找到localhost:7474,复制到浏览器进行登录,初始用户名和密码均为neo4j

其实在最顶端的窗口可以直接进行图谱的搭建,但由于本文是实现 Python进行构建,所以不在此进行赘述。

Pycharm及代码实现

 py2neo

neo4j提供python接口,可以使用py2neo库通过python操作neo4j数据库,py2neo安装较为简单,仅需要使用pip install方式进行安装。使用如下命令:

pip install py2neo

 安装完后进行测试:

from py2neo import Graph, Node, Relationshipdef connect_database(username, password, dbname):graph_db = Graph("http://localhost:7474", name=dbname, auth=(username, password))return graph_dbif __name__ == '__main__':graph = connect_database("neo4j", "password", "neo4j")

 数据集获取

 将以下内容复制到txt文件中,再改为csv文件

 

"head","tail","relation","label"
"贾代善","贾源","son","子"
"娄氏","贾源","daughter_in_law_of_grandson","重孙媳妇"
"贾母","贾代善","wife","妻"
"老姨奶奶","贾代善","concubine","妾"
"贾敏","贾代善","daughter","女"
"嫣红","贾赦","concubine","妾"
"翠云","贾赦","concubine","妾"
"娇红","贾赦","concubine","妾"
"贾迎春","贾赦","daughter","女"
"赵姨娘","贾政","concubine","妾"
"周姨娘","贾政","concubine","妾"
"贾珠","贾政","son","子"
"尤二姐","贾琏","concubine","妾"
"秋桐","贾琏","concubine","妾"
"平儿","贾琏","concubine","妾"
"薛宝衩","贾宝玉","wife","妻"
"花袭人","贾宝玉","concubine","妾"
"贾桂","贾宝玉","son","子"
"贾菌","娄氏","son","子"
"周秀才","贾巧姐","brother_in_law","姐夫"
"周财主","周秀才","father","父亲"
"周妈妈","周秀才","mother","母亲"
"孙亲太太","孙绍祖","mother","母亲"
"刑大舅二姐","邢夫人","younger_sister","妹"
"邢德全","邢夫人","younger_brother","弟"
"张大老爷","邢夫人","old_relatives","老亲"
"邢忠","邢夫人","elder_brother","兄"
"张大老爷之女","张大老爷","daughter","女"
"刑秞烟","邢忠","daughter","女"
"李婶","李守中","sister_in_law","弟媳"
"李婶之弟","李婶","younger_brother","弟"
"李纹","李婶","daughter","女"
"甄宝玉","李绮","husband","夫"
"甄应嘉","甄宝玉祖母","son","子"
"甄夫人","甄应嘉","wife","妻"
"大姑娘","甄应嘉","daughter","女"
"二姑娘","甄应嘉","daughter","女"
"三姑娘","甄应嘉","daughter","女"
"袭人之母","袭人","mother","母亲"
"花自芳","袭人","elder_brother","兄"
"周琼之子","贾探春","husband","夫"
"林如海之父","林如海","father","父亲"
"林如海之祖","林如海","grandfather","祖父"
"林如海之子","林如海","son","子"
"李妈","贾巧姐","nurser","乳母"
"昭儿","贾琏","servant","奴仆"
"兴儿","贾琏","servant","奴仆"
"隆儿","贾琏","servant","奴仆"
"庆儿","贾琏","servant","奴仆"
"赵嬷嬷","贾琏","nurser","乳母"
"赵天梁","赵嬷嬷","son","子"
"赵天栋","赵嬷嬷","son","子"
"王信","贾琏","servant","奴仆"
"王信媳妇","贾琏","servant","奴仆"
"鲍二","贾琏","servant","奴仆"
"善姐","尤二姐","servant_girl","丫鬟"
"迎春乳母","贾迎春","nurser","乳母"
"王住儿媳妇","迎春乳母","daughter_in_law","子媳"
"绣桔","贾迎春","servant_girl","丫鬟"
"莲花儿","贾迎春","servant_girl","丫鬟"
"秦思祺","贾迎春","servant_girl","丫鬟"
"潘又安","秦思祺","boy_friend","男友"
"贾琮奶妈","贾琮","nurser","乳母"
"篆儿","刑秞烟","servant_girl","丫鬟"
"新进来的奶子","贾兰","nurser","奶妈"
"素云","李纨","servant_girl","丫鬟"
"碧月","李纨","servant_girl","丫鬟"
"抱琴","贾元春","servant_girl","丫鬟"
"李嬷嬷","贾宝玉","nurser","乳母"
"赵嬷嬷","贾宝玉","nurser","乳母"
"张嬷嬷","贾宝玉","nurser","乳母"
"宋嬷嬷","贾宝玉","servant","奴仆"
"叶茗烟","贾宝玉","servant","奴仆"
"锄药","贾宝玉","servant","奴仆"
"扫红","贾宝玉","servant","奴仆"
"墨雨","贾宝玉","servant","奴仆"
"引泉","贾宝玉","servant","奴仆"
"扫花","贾宝玉","servant","奴仆"
"挑云","贾宝玉","servant","奴仆"
"伴鹤","贾宝玉","servant","奴仆"
"双瑞","贾宝玉","servant","奴仆"
"双寿","贾宝玉","servant","奴仆"
"老叶妈","叶茗烟","mother","母亲"
"李贵","李嬷嬷","son","子"
"李嬷嬷孙子","贾宝玉","servant","奴仆"
"王荣","贾宝玉","servant","奴仆"
"张若锦","贾宝玉","servant","奴仆"
"赵亦华","贾宝玉","servant","奴仆"
"周瑞","王夫人","servant","奴仆"
"周瑞女儿","周瑞","daughter","女"
"冷子兴","周瑞","son_in_law","女婿"
"周嫂子的儿子","周瑞","son","子"
"何三","周瑞","adopted_son","干儿子"
"白金钏","王夫人","servant_girl","丫鬟"
"白玉钏","王夫人","servant_girl","丫鬟"
"彩云","王夫人","servant_girl","丫鬟"
"彩鸾","王夫人","servant_girl","丫鬟"
"绣鸾","王夫人","servant_girl","丫鬟"
"绣凤","王夫人","servant_girl","丫鬟"
"白老媳妇","白金钏","mother","母亲"
"白老媳妇","白玉钏","mother","母亲"
"彩霞之母","彩霞","mother","母亲"
"小霞","彩霞","younger_sister","妹"
"小鹊","赵姨娘","servant_girl","丫鬟"
"小吉祥","赵姨娘","servant_girl","丫鬟"
"赵国基","赵姨娘","elder_brother","兄"
"钱槐","赵姨娘","elder_male_cousin","表兄"
"钱槐","贾环","servant","奴仆"
"雪雁","林黛玉","servant_girl","丫鬟"
"王嬷嬷","林黛玉","nurser","乳母"
"紫鹊","林黛玉","servant_girl","丫鬟"
"春纤","林黛玉","servant_girl","丫鬟"
"藕官","林黛玉","servant_girl","丫鬟"
"赖嬷嬷","赖大","mother","母亲"
"赖尚荣","赖大","son","子"
"赖大的女儿","赖大","daughter","女"
"来旺儿","王熙凤","servant","奴仆"
"旺儿媳妇","王熙凤","servant_girl","丫鬟"
"来喜家的","王熙凤","servant","奴仆"
"丰儿","王熙凤","servant_girl","丫鬟"
"彩明","王熙凤","servant_girl","丫鬟"
"林红玉","王熙凤","servant_girl","丫鬟"
"林之孝","林红玉","father","父亲"
"王善保","邢夫人","servant","奴仆"
"费婆子","邢夫人","servant_girl","丫鬟"
"金鸳鸯","贾母","servant_girl","丫鬟"
"琥珀","贾母","servant_girl","丫鬟"
"鹦鹉","贾母","servant_girl","丫鬟"
"珍珠","贾母","servant_girl","丫鬟"
"翡翠","贾母","servant_girl","丫鬟"
"玻璃","贾母","servant_girl","丫鬟"
"文官","贾母","servant_girl","丫鬟"
"傻大姐的娘","傻大姐","mother","母亲"
"金彩","鸳鸯","father","父亲"
"金文翔","鸳鸯","elder_brother","兄"
"多官","晴雯","elder_male_cousin","表哥"
"多浑虫父亲","晴雯","mothers_brother","舅"
"多姑娘儿","多官","wife","妻"
"吴贵","晴雯","elder_male_cousin","表兄"
"花芳官","贾宝玉","servant_girl","丫鬟"
"媚人","贾宝玉","servant_girl","丫鬟"
"麝月","贾宝玉","servant_girl","丫鬟"
"茜雪","贾宝玉","servant_girl","丫鬟"
"秋纹","贾宝玉","servant_girl","丫鬟"
"绮霞","贾宝玉","servant_girl","丫鬟"
"碧痕","贾宝玉","servant_girl","丫鬟"
"檀云","贾宝玉","servant_girl","丫鬟"
"四儿","贾宝玉","servant_girl","丫鬟"
"佳蕙","贾宝玉","servant_girl","丫鬟"
"坠儿","贾宝玉","servant_girl","丫鬟"
"紫绡","贾宝玉","servant_girl","丫鬟"
"良儿","贾宝玉","servant_girl","丫鬟"
"何春燕","贾宝玉","servant_girl","丫鬟"
"厨房中的柳家媳妇","柳五儿","mother","母亲"
"柳二媳妇的妹子","柳五儿","younger_sister","妹"
"哥嫂侄儿","柳五儿","nephew","侄"
"侍书","贾探春","servant_girl","丫鬟"
"翠墨","贾探春","servant_girl","丫鬟"
"艾官","贾探春","servant_girl","丫鬟"
"小蝉","贾探春","servant_girl","丫鬟"
"何婆","何春燕","mother","母亲"
"何婆","芳官","adopted_mother","干娘"
"小鸠儿","何春燕","younger_sister","妹"
"夏婆子","何春燕","maternal_aunt","姨妈"
"夏婆子","藕官","adopted_mother","干娘"
"夏婆子","小蝉","grandmother","外祖母"
"蒋玉菡","贾宝玉","friend","朋友"
"通判傅试","贾政","pupil","门生"
"傅秋芳","傅试","younger_sister","妹"
"太祖皇帝","先皇","father","父亲"
"太上皇","先皇","son","子"
"皇太后","太上皇","wife","妻"
"太妃","太上皇","kings_concubine","嫔妃"
"皇帝","太上皇","son","子"
"贾元春","皇帝","imperial_concubine","妃"
"吴贵妃","皇帝","imperial_concubine","妃"
"周贵人","皇帝","imperial_concubine","妃"
"周贵人父亲","周贵人","father","父亲"
"吴天佑","吴贵妃","father","父亲"
"戴权","皇帝","minister","臣"
"夏守忠","皇帝","minister","臣"
"贾代化","贾演","son","子"
"焦大","贾演","servant","奴仆"
"贾敷","贾代化","son","子"
"贾敬","贾代化","son","子"
"贾惜春","贾敬","daughter","女"
"史湘云爷爷","史侯","son","子"
"史鼐","史湘云爷爷","son","子"
"史鼎","史湘云爷爷","son","子"
"湘云母","史湘云爷爷","daughter_in_law","儿媳"
"史鼎的夫人","史鼎","wife","妻"
"史湘云","湘云母","daughter","女"
"卫若兰","史湘云","husband","夫"
"翠缕","史湘云","servant_girl","丫鬟"
"葵官","史湘云","servant_girl","丫鬟"
"周奶妈","史湘云","nurser","乳母"
"凤姐之祖王夫人之父","王公","son","子"
"王夫人之大兄凤姐之父","凤姐之祖王夫人之父","son","子"
"王子腾","凤姐之祖王夫人之父","son","子"
"王子胜","凤姐之祖王夫人之父","son","子"
"王夫人","凤姐之祖王夫人之父","daughter","女"
"薛姨妈","凤姐之祖王夫人之父","daughter","女"
"王成父","凤姐之祖王夫人之父","nephew","侄"
"老舅太太","王夫人之大兄凤姐之父","wife","妻"
"王仁","王夫人之大兄凤姐之父","son","子"
"王熙凤","王夫人之大兄凤姐之父","daughter","女"
"王子腾夫人","王子腾","wife","妻"
"王子腾之女","王子腾","daughter","女"
"保宁侯之子","王子腾之女","husband","夫"
"王成","王成父","son","子"
"王狗儿","王成","son","子"
"刘氏","王狗儿","wife","妻"
"王青儿","王狗儿","daughter","女"
"王板儿","王狗儿","son","子"
"刘姥姥","刘氏","mother","母亲"
"宝钗祖父","薛公","son","子"
"薛公之孙","宝钗祖父","son","子"
"薛宝琴父","宝钗祖父","son","子"
"薛姨妈","薛公之孙","wife","妻"
"薛宝钗","薛公之孙","daughter","女"
"薛蟠","薛公之孙","son","子"
"同喜","薛姨妈","servant_girl","丫鬟"
"同贵","薛姨妈","servant_girl","丫鬟"
"莺儿","薛宝钗","servant_girl","丫鬟"
"文杏","薛宝钗","servant_girl","丫鬟"
"喜儿","薛宝钗","servant_girl","丫鬟"
"蕊官","薛宝钗","servant_girl","丫鬟"
"夏金桂","薛蟠","wife","妻"
"老苍头","薛蟠","meme_ama","乳父"
"宝蟾","夏金桂","servant_girl","丫鬟"
"小舍儿","夏金桂","servant_girl","丫鬟"
"夏奶奶","夏金桂","mother","母亲"
"夏三","夏奶奶","son","子"
"臻儿","香菱","servant_girl","丫鬟"
"薛宝琴母","薛宝琴父","wife","妻"
"薛蝌","薛宝琴父","son","子"
"薛宝琴","薛宝琴父","daughter","女"
"邢岫烟","薛蝌","wife","妻"
"梅翰林之子","薛宝琴","husband","夫"
"小螺","薛宝琴","servant_girl","丫鬟"
"荳官","薛宝琴","servant_girl","丫鬟"
"梅翰林","梅翰林之子","father","父亲"
"贾瑞之父","贾代儒","son","子"
"贾瑞之母","贾瑞之父","wife","妻"
"贾瑞","贾瑞之父","son","子"
"贾琼","贾琼之母","son","子"
"贾四姐","贾琼之母","daughter","女"
"贾王扁","贾王扁之母","son","子"
"贾喜鸾","贾王扁之母","daughter","女"
"贾芸","五嫂子卜氏","son","子"
"卜世仁","五嫂子卜氏","brother","兄弟"
"小丫头子","贾芸","servant_girl","丫鬟"
"倪儿娘子","倪二","wife","妻"
"倪二女儿","倪二","daughter","女"
"马贩子王短腿","倪二","friend","友人"
"卜世仁娘子","卜世仁","wife","妻"
"卜银姐","卜世仁","daughter","女"
"王奶奶","卜世仁","neighbour","邻居"
"卜世仁店里伙计","卜世仁","partner","伙计"
"贾芹","周氏","son","子"
"金氏","贾璜","wife","妻"
"胡氏","金氏","elder_sister_in_law","嫂"
"金荣","胡氏","son","子"
"娇杏","贾化","wife","妻"
"贾雨村子","贾化","son","子"
"应天府门子","贾化","son","子"
"张如圭","贾化","friend","友人"
"王老爷","贾化","friend","友人"
"天子之妻","应天府门子","wife","妻"
"东安郡王穆莳拜","东平郡王","son","子"
"南安王太妃","南安郡王","wife","妻"
"南安郡王之孙","南安郡王","grandson","孙子"
"西宁郡王之孙","西宁郡王","grandson","孙子"
"西宁郡王妃","西宁郡王","wife","妻"
"北静王太妃","北静郡王","daughter_in_law","儿媳"
"北静王少妃","水溶","wife","妻"
"北静郡王长府官","水溶","minister","臣"
"镇国公诰命","牛清","wife","妻"
"镇国公诰命长男","牛清","son","子"
"牛继宗","牛清","grandson","孙子"
"柳芳","柳彪","grandson","孙子"
"陈瑞文","陈翼","grandson","孙子"
"马尚","马魁","grandson","孙子"
"侯孝康","侯明","grandson","孙子"
"缮国公诰命","缮国公","wife","妻"
"石光珠","缮国公","grandson","孙子"
"蒋子宁","平原侯","grandson","孙子"
"谢鲸","定城侯","grandson","孙子"
"戚建辉","襄阳侯","grandson","孙子"
"裘良","景田侯","grandson","孙子"
"锦乡侯诰命","锦乡侯","wife","妻"
"韩奇","锦乡侯","son","子"
"冯紫英","神武将军冯唐","son","子"
"锦田侯诰命","马道婆","donor","施主"
"蕊官","地藏庵的圆心","pupil","徒弟"
"藕官","圆心","pupil","徒弟"
"智能儿","净虚","pupil","徒弟"
"智善","净虚","pupil","徒弟"
"智通","净虚","pupil","徒弟"
"于老爷","净虚","donor","施主"
"胡老爷","净虚","donor","施主"
"胡老爷太太","净虚","donor","施主"
"胡老爷公子","净虚","donor","施主"
"张大财主","净虚","donor","施主"
"花芳官","智能","pupil","徒弟"
"张金哥","张大财主","daughter","女"
"李公子","张金哥","employer","雇主"
"长安原任守备","李公子","father","父亲"
"李衙内","长安府府太爷","mothers_brother","小舅子"
"贾代化","贾演","son","子"
"焦大","贾演","servant","奴仆"
"贾敷","贾代化","son","子"
"贾敬","贾代化","son","子"
"尤氏","尤老娘","daughter","女"
"贾蔷","贾演","great_great_grandson","玄孙"
"龄官","贾蔷","girl_friend","女友"
"佩凤","贾珍","concubine","妾"
"偕鸾","贾珍","concubine","妾"
"文花","贾珍","concubine","妾"
"茄官","尤氏","servant_girl","丫鬟"
"银蝶","尤氏","servant_girl","丫鬟"
"炒豆儿","尤氏","servant_girl","丫鬟"
"秦可卿","贾蓉","wife","妻"
"胡氏","贾蓉","step_wife","续弦"
"许氏","贾蓉","step_wife","续弦"
"入画","贾惜春","servant_girl","丫鬟"
"彩屏","贾惜春","servant_girl","丫鬟"
"彩儿","贾惜春","servant_girl","丫鬟"
"瑞珠","秦可卿","servant_girl","丫鬟"
"宝珠","秦可卿","servant_girl","丫鬟"
"秦钟","秦业","son","子"
"智能儿","秦钟","girl_friend","女友"
"净虚","智能儿","master","师父"
"智善","净虚","pupil","徒弟"
"智通","净虚","pupil","徒弟"
"喜儿","贾珍","servant","奴仆"
"寿儿","贾珍","servant","奴仆"
"尤三姐","柳湘莲","girl_friend","女友"
"杏奴","柳湘莲","servant","奴仆"
"尤二姐","贾琏","concubine","妾"
"善姐","尤二姐","servant_girl","丫鬟"
"甄宝玉","李绮","husband","夫"
"贾演","贾源","elder_brother","兄"
"贾赦","贾代善","son","子"
"贾政","贾代善","son","子"
"贾敏","贾政","younger_sister","妹"
"邢夫人","贾赦","wife","妻"
"贾琏","贾赦","son","子"
"贾琮","贾赦","son","子"
"王夫人","贾政","wife","妻"
"贾元春","贾政","daughter","女"
"贾宝玉","贾政","son","子"
"贾探春","贾政","daughter","女"
"贾环","贾政","son","子"
"王熙凤","贾琏","wife","妻"
"贾巧姐","贾琏","daughter","女"
"贾兰","贾珠","son","子"
"李纨","贾珠","wife","妻"
"孙绍祖","贾迎春","husband","夫"
"李守中","李纨","father","父亲"
"李绮","李婶","daughter","女"
"甄宝玉","甄应嘉","son","子"
"林如海","贾敏","husband","夫"
"林黛玉","林如海","daughter","女"
"王嬷嬷","贾宝玉","nurser","乳母"
"彩霞","王夫人","servant_girl","丫鬟"
"傻大姐","贾母","servant_girl","丫鬟"
"晴雯","贾宝玉","servant_girl","丫鬟"
"篆儿","贾宝玉","servant_girl","丫鬟"
"柳五儿","贾宝玉","servant_girl","丫鬟"
"贾珍","贾敬","son","子"
"贾母","史侯","daughter","女"
"香菱","薛蟠","concubine","妾"
"倪二","贾芸","friend","友人"
"水溶","北静郡王","grandson","孙子"
"尤氏","贾珍","wife","妻"
"尤二姐","尤老娘","daughter","女"
"尤三姐","尤老娘","daughter","女"
"贾蓉","贾珍","son","子"
"秦可卿","秦业","daughter","女"

代码介绍

由于大部分代码都进行了注释,所以大家可以直接拷贝代码进行学习,在此不赘述代码作用

import csv
from py2neo import Graph, Node, Relationship# 创建与 Neo4j 数据库的连接
g = Graph('http://localhost:7474', user='neo4j', password='neo4j123..', name="neo4j")# 打开 CSV 文件
with open('HongLou.csv', 'r', encoding='utf-8') as f:# 创建一个 CSV 读取器reader = csv.reader(f)# 遍历 CSV 文件中的每一行for item in reader:# 跳过标题行,因为从第二行开始才是人物信息if reader.line_num == 1:continue# 打印当前行号和内容print("当前行数:", reader.line_num, "当前内容:", item)# 使用 CSV 中的值创建起始节点和结束节点,节点标签为 'Person',名称属性来自 CSVstart_node = Node("Person", name=item[0])end_node = Node("Person", name=item[1])# 使用 CSV 中的值创建起始节点和结束节点之间的关系,关系类型为 CSV 中的值relation = Relationship(start_node, item[3], end_node)# 将起始节点和结束节点合并到图中,使用节点标签 'Person' 和名称属性进行匹配g.merge(start_node, "Person", "name")g.merge(end_node, "Person", "name")# 将关系合并到图中,使用节点标签 'Person' 和名称属性进行匹配g.merge(relation, "Person", "name")

 最后回到我们的neo4j中就能看到关系图谱啦

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/296905.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Vue.js基础指令

(在讲指令之前,可以先了解插值表达式,如果已经知道,当我没说) 一.插值表达式 1.数据绑定最常见的形式就是双大括号的文本插值,Mustache上属性的值替代。只要绑定的数据对象上属性发生了改变,插值处的内容都会更新。,message 是将数据解析成纯文本的,也就是说,就算中…

Linux之进程间通信

1.进程间通信的目的 数据传输:一个进程需要将它的数据发送给另一个进程 资源共享:多个进程之间共享同样的资源。 通知事件:一个进程需要向另一个或一组进程发送消息,通知它(它们)发生了某种事件&#xff…

FressRTOS_day4:2024/4/4

1.总结二进制信号量和计数型信号量的区别,以及他们的使用场景。 二进制信号量的数值只有0和1。(用于共享资源的访问);而计数型信号量的值一般是大于或者等于2(用于生产者和消费者模型) 2.使用计数型信号量…

【linux】进程替换的应用|shell解释器的实现

当我们学过了进程替换之后,本篇文章可以根据进程替换的知识带你自主实现一个shell命令行 实现步骤 1.显示命令行提示 2.读取输入指令以及对应选项 3.分割第二步的指令以及选项到命令行参数表中 4.处理内建命令 5.进程替换 1.显示命令行提示 我们通过观察bash的命令行…

计算机网络:局域网的数据链路层

✨✨ 欢迎大家来访Srlua的博文(づ ̄3 ̄)づ╭❤~✨✨ 🌟🌟 欢迎各位亲爱的读者,感谢你们抽出宝贵的时间来阅读我的文章。 我是Srlua小谢,在这里我会分享我的知识和经验。&am…

Java基础 - 代码练习

第一题&#xff1a;集合的运用&#xff08;幸存者&#xff09; public class demo1 {public static void main(String[] args) {ArrayList<Integer> array new ArrayList<>(); //一百个囚犯存放在array集合中Random r new Random();for (int i 0; i < 100; …

红黑树的性质与操作:吸收红结点及其对树结构的影响

红黑树的性质与操作&#xff1a;吸收红结点及其对树结构的影响 1.红黑树的基本性质2.吸收红结点的过程2.1黑色结点的度2.2 叶结点深度 3.伪代码实现4. C语言代码实现5. 结论 红黑树作为一种高效的自平衡二叉搜索树&#xff0c;在计算机科学中扮演着重要的角色。它通过一系列复杂…

开源软件技术社区方案

开源软件技术社区是一个由开发者、贡献者、用户和维护者组成的共享平台&#xff0c;主要目的是打造技术、软件产品良性互动、开源技术安全可控的软件生态环境&#xff0c;实现可复用应用或服务的快速部署与使用、完成资源与能力的高度共享、促进社区成员的共建共赢&#xff0c;…

电池二次利用走向可持续大循环周期的潜力和挑战(第一篇)

一、背景 当前&#xff0c;气候变化是全球可持续发展面临的重大挑战。缓解气候变化最具挑战性的目标是在本世纪中期实现碳中和&#xff08;排放量低到足以被自然系统安全吸收&#xff09;&#xff0c;其中电动汽车&#xff08;EV&#xff09;的引入是一项关键举措。电动汽车在…

CSS3新增的语法(三)【2D,3D,过渡,动画】

CSS3新增的语法&#xff08;三&#xff09;【2D,3D,过渡&#xff0c;动画】 10.2D变换10.1. 2D位移10.2. 2D缩放10.3. 2D旋转10.4. 2D扭曲&#xff08;了解&#xff09;10.5. 多重变换10.6. 变换原点 11. 3D变换11.1. 开启3D空间11.2. 设置景深11.3. 透视点位置11.4. 3D 位移11…

为 AI 而生的编程语言「GitHub 热点速览」

Mojo 是一种面向 AI 开发者的新型编程语言。它致力于将 Python 的简洁语法和 C 语言的高性能相结合&#xff0c;以填补研究和生产应用之间的差距。Mojo 自去年 5 月发布后&#xff0c;终于又有动作了。最近&#xff0c;Mojo 的标准库核心模块已在 GitHub 上开源&#xff0c;采用…

【Spring】使用@Bean和@Import注解配置Bean,与Bean的实例化

目录 1、bean是什么 2、配置bean 2.1、使用Bean注解配置Bean 2.2、使用Import注解配置Bean 3、实例化Bean 1、bean是什么 在 Spring 中&#xff0c;Bean 是指由 Spring 容器管理的对象。Spring IOC 容器负责创建、配置和管理这些 Bean 对象的生命周期。Spring IOC 容器会管…

链表之单链表

上一篇博客我们学习了线性表中的顺序表&#xff0c;这一篇博客让我们继续往下了解线性表的链表&#xff0c;链表分为好几种结构&#xff0c;活不多说&#xff0c;让我们开始学习吧&#xff01; 目录 1.链表 2.链表的结构 3.单链表的实现 1.链表 1.概念&#xff1a;它是一种物…

Folder Icons for Mac v1.8 激活版文件夹个性化图标修改软件

Folder Icons for Mac是一款Mac OS平台上的文件夹图标修改软件&#xff0c;同时也是一款非常有意思的系统美化软件。这款软件的主要功能是可以将Mac的默认文件夹图标更改为非常漂亮有趣的个性化图标。 软件下载&#xff1a;Folder Icons for Mac v1.8 激活版 以下是这款软件的一…

【2024系统架构设计】案例分析- 5 Web应用

目录 一 基础知识 二 真题 一 基础知识 1 Web应用技术分类 大型网站系统架构的演化:高性能、高可用、可维护、应变、安全。 从架构来看:MVC,MVP,MVVM,REST,Webservice,微服务。

Spark-Scala语言实战(11)

在之前的文章中&#xff0c;我们学习了如何在spark中使用RDD中的cartesian,subtract最终两种方法。想了解的朋友可以查看这篇文章。同时&#xff0c;希望我的文章能帮助到你&#xff0c;如果觉得我的文章写的不错&#xff0c;请留下你宝贵的点赞&#xff0c;谢谢。 Spark-Scal…

数据结构进阶篇 之 【交换排序】(冒泡排序,快速排序递归、非递归实现)

当你觉的自己不行时&#xff0c;你就走到斑马线上&#xff0c;这样你就会成为一个行人 一、交换排序 1.冒泡排序 BubbleSort 1.1 基本思想 1.2 实现原理 1.3 代码实现 1.4 冒泡排序的特性总结 2.快速排序 QuickSort 2.1 基本思想 2.2 递归实现 2.2.1 hoare版 2.2.2 …

【JAVASE】面向对象程序三大特性之一( 封装)

✅作者简介&#xff1a;大家好&#xff0c;我是橘橙黄又青&#xff0c;一个想要与大家共同进步的男人&#x1f609;&#x1f609;\n &#x1f34e;个人主页&#xff1a;再无B&#xff5e;U&#xff5e;G-CSDN博客 目标&#xff1a; 1.包的使用 2.static关键字的使用 3.代码…

苹果手表Apple Watch录了两个半小时的录音,却只能播放4秒,同步到手机也一样,还能修复好吗?

好多人遇到这个情况&#xff0c;用苹果手表Apple Watch录音&#xff0c;有的录1个多小时&#xff0c;有的录了3、4小时&#xff0c;甚至更长时间&#xff0c;因为手表没电&#xff0c;忘记保存等原因造成录音损坏&#xff0c;都是只能播放4秒&#xff0c;同步到手机也一样&…

游戏引擎中的物理应用

一、 角色控制器 Character Controller和普通的动态对象&#xff08;Dynamic Actor &#xff09;是不同的&#xff0c;主要的三个特点是: 它拥有可控制的刚体间的交互假设它是有无穷的摩擦力&#xff08;可以站停在位置上&#xff09;&#xff0c;没有弹性加速和刹车几乎立即…