{"id":13474525,"url":"https://github.com/shenweichen/GraphEmbedding","last_synced_at":"2025-03-26T21:31:43.843Z","repository":{"id":37507486,"uuid":"170161902","full_name":"shenweichen/GraphEmbedding","owner":"shenweichen","description":"Implementation and experiments  of graph embedding algorithms.","archived":false,"fork":false,"pushed_at":"2024-03-14T09:28:18.000Z","size":681,"stargazers_count":3782,"open_issues_count":45,"forks_count":999,"subscribers_count":62,"default_branch":"master","last_synced_at":"2025-03-22T17:05:26.038Z","etag":null,"topics":["deepwalk","graph","graphembedding","line","node2vec","sdne","struc2vec"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shenweichen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-02-11T16:27:20.000Z","updated_at":"2025-03-19T07:46:00.000Z","dependencies_parsed_at":"2025-02-14T07:12:37.074Z","dependency_job_id":"02474059-45be-4326-bda9-21536bfa6378","html_url":"https://github.com/shenweichen/GraphEmbedding","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shenweichen%2FGraphEmbedding","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shenweichen%2FGraphEmbedding/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shenweichen%2FGraphEmbedding/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shenweichen%2FGraphEmbedding/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shenweichen","download_url":"https://codeload.github.com/shenweichen/GraphEmbedding/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245738718,"owners_count":20664333,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deepwalk","graph","graphembedding","line","node2vec","sdne","struc2vec"],"created_at":"2024-07-31T16:01:12.928Z","updated_at":"2025-03-26T21:31:43.367Z","avatar_url":"https://github.com/shenweichen.png","language":"Python","readme":"# GraphEmbedding\n\n[![GitHub Issues](https://img.shields.io/github/issues/shenweichen/graphembedding.svg\n)](https://github.com/shenweichen/graphembedding/issues)\n![CI status](https://github.com/shenweichen/graphembedding/workflows/CI/badge.svg)\n[![codecov](https://codecov.io/gh/shenweichen/graphembedding/branch/master/graph/badge.svg)](https://codecov.io/gh/shenweichen/graphembedding)\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/c46407f5931f40048e28860dccf7dabc)](https://www.codacy.com/gh/shenweichen/GraphEmbedding/dashboard?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=shenweichen/GraphEmbedding\u0026amp;utm_campaign=Badge_Grade)\n[![Disscussion](https://img.shields.io/badge/chat-wechat-brightgreen?style=flat)](./README.md#disscussiongroup--related-projects)\n\n[comment]: \u003c\u003e ([![License]\u0026#40;https://img.shields.io/github/license/shenweichen/graphembedding.svg\u0026#41;]\u0026#40;https://github.com/shenweichen/graphembedding/blob/master/LICENSE\u0026#41;)\n\n# Method\n\n\n|   Model   | Paper                                                                                                                      | Note                                                                                        |\n| :-------: | :------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------ |\n| DeepWalk  | [KDD 2014][DeepWalk: Online Learning of Social Representations](http://www.perozzi.net/publications/14_kdd_deepwalk.pdf)   | [【Graph Embedding】DeepWalk：算法原理，实现和应用](https://zhuanlan.zhihu.com/p/56380812)  |\n|   LINE    | [WWW 2015][LINE: Large-scale Information Network Embedding](https://arxiv.org/pdf/1503.03578.pdf)                          | [【Graph Embedding】LINE：算法原理，实现和应用](https://zhuanlan.zhihu.com/p/56478167)      |\n| Node2Vec  | [KDD 2016][node2vec: Scalable Feature Learning for Networks](https://www.kdd.org/kdd2016/papers/files/rfp0218-groverA.pdf) | [【Graph Embedding】Node2Vec：算法原理，实现和应用](https://zhuanlan.zhihu.com/p/56542707)  |\n|   SDNE    | [KDD 2016][Structural Deep Network Embedding](https://www.kdd.org/kdd2016/papers/files/rfp0191-wangAemb.pdf)               | [【Graph Embedding】SDNE：算法原理，实现和应用](https://zhuanlan.zhihu.com/p/56637181)      |\n| Struc2Vec | [KDD 2017][struc2vec: Learning Node Representations from Structural Identity](https://arxiv.org/pdf/1704.03165.pdf)        | [【Graph Embedding】Struc2Vec：算法原理，实现和应用](https://zhuanlan.zhihu.com/p/56733145) |\n\n\n# How to run examples\n1. clone the repo and make sure you have installed `tensorflow` or `tensorflow-gpu` on your local machine. \n2. run following commands\n```bash\npython setup.py install\ncd examples\npython deepwalk_wiki.py\n```\n\n## DisscussionGroup \u0026 Related Projects\n\n\u003chtml\u003e\n    \u003ctable style=\"margin-left: 20px; margin-right: auto;\"\u003e\n        \u003ctr\u003e\n            \u003ctd\u003e\n                公众号：\u003cb\u003e浅梦学习笔记\u003c/b\u003e\u003cbr\u003e\u003cbr\u003e\n                \u003ca href=\"https://github.com/shenweichen/GraphEmbedding\"\u003e\n  \u003cimg align=\"center\" src=\"./pics/code.png\" /\u003e\n\u003c/a\u003e\n            \u003c/td\u003e\n            \u003ctd\u003e\n                微信：\u003cb\u003edeepctrbot\u003c/b\u003e\u003cbr\u003e\u003cbr\u003e\n \u003ca href=\"https://github.com/shenweichen/GraphEmbedding\"\u003e\n  \u003cimg align=\"center\" src=\"./pics/deepctrbot.png\" /\u003e\n\u003c/a\u003e\n            \u003c/td\u003e\n            \u003ctd\u003e\n\u003cul\u003e\n\u003cli\u003e\u003ca href=\"https://github.com/shenweichen/AlgoNotes\"\u003eAlgoNotes\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://github.com/shenweichen/DeepCTR\"\u003eDeepCTR\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://github.com/shenweichen/DeepMatch\"\u003eDeepMatch\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://github.com/shenweichen/DeepCTR-Torch\"\u003eDeepCTR-Torch\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n            \u003c/td\u003e\n        \u003c/tr\u003e\n    \u003c/table\u003e\n\u003c/html\u003e\n\n# Usage\nThe design and implementation follows simple principles(**graph in,embedding out**) as much as possible.\n## Input format\nwe use `networkx`to create graphs.The input of networkx graph is as follows:\n`node1 node2 \u003cedge_weight\u003e`\n\n![](./pics/edge_list.png)\n## DeepWalk\n\n```python\nG = nx.read_edgelist('../data/wiki/Wiki_edgelist.txt',create_using=nx.DiGraph(),nodetype=None,data=[('weight',int)])# Read graph\n\nmodel = DeepWalk(G,walk_length=10,num_walks=80,workers=1)#init model\nmodel.train(window_size=5,iter=3)# train model\nembeddings = model.get_embeddings()# get embedding vectors\n```\n\n## LINE\n\n```python\nG = nx.read_edgelist('../data/wiki/Wiki_edgelist.txt',create_using=nx.DiGraph(),nodetype=None,data=[('weight',int)])#read graph\n\nmodel = LINE(G,embedding_size=128,order='second') #init model,order can be ['first','second','all']\nmodel.train(batch_size=1024,epochs=50,verbose=2)# train model\nembeddings = model.get_embeddings()# get embedding vectors\n```\n## Node2Vec\n```python\nG=nx.read_edgelist('../data/wiki/Wiki_edgelist.txt',\n                        create_using = nx.DiGraph(), nodetype = None, data = [('weight', int)])#read graph\n\nmodel = Node2Vec(G, walk_length = 10, num_walks = 80,p = 0.25, q = 4, workers = 1)#init model\nmodel.train(window_size = 5, iter = 3)# train model\nembeddings = model.get_embeddings()# get embedding vectors\n```\n## SDNE\n\n```python\nG = nx.read_edgelist('../data/wiki/Wiki_edgelist.txt',create_using=nx.DiGraph(),nodetype=None,data=[('weight',int)])#read graph\n\nmodel = SDNE(G,hidden_size=[256,128]) #init model\nmodel.train(batch_size=3000,epochs=40,verbose=2)# train model\nembeddings = model.get_embeddings()# get embedding vectors\n```\n\n## Struc2Vec\n\n\n```python\nG = nx.read_edgelist('../data/flight/brazil-airports.edgelist',create_using=nx.DiGraph(),nodetype=None,data=[('weight',int)])#read graph\n\nmodel = Struc2Vec(G, 10, 80, workers=4, verbose=40, ) #init model\nmodel.train(window_size = 5, iter = 3)# train model\nembeddings = model.get_embeddings()# get embedding vectors\n```\n","funding_links":[],"categories":["Python","图数据处理","Graph","图嵌入、网络表征学习"],"sub_categories":["Others","网络服务_其他"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshenweichen%2FGraphEmbedding","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshenweichen%2FGraphEmbedding","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshenweichen%2FGraphEmbedding/lists"}