{"id":20191418,"url":"https://github.com/htfy96/network_algo","last_synced_at":"2026-02-19T12:02:57.324Z","repository":{"id":86702029,"uuid":"50512991","full_name":"htfy96/network_algo","owner":"htfy96","description":"A C++ framework for network analysis. Migrated to Gitlab:","archived":false,"fork":false,"pushed_at":"2016-06-05T15:39:34.000Z","size":142,"stargazers_count":2,"open_issues_count":0,"forks_count":3,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-01-04T11:22:03.407Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://gitlab.com/htfy96/network_algo","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/htfy96.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":"2016-01-27T14:30:39.000Z","updated_at":"2016-04-26T14:58:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"108002b7-a84a-4d54-a774-9591d99322af","html_url":"https://github.com/htfy96/network_algo","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/htfy96%2Fnetwork_algo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/htfy96%2Fnetwork_algo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/htfy96%2Fnetwork_algo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/htfy96%2Fnetwork_algo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/htfy96","download_url":"https://codeload.github.com/htfy96/network_algo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240271540,"owners_count":19774859,"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":[],"created_at":"2024-11-14T03:49:00.984Z","updated_at":"2025-10-16T22:52:03.417Z","avatar_url":"https://github.com/htfy96.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"#Network Algorithm ![test status](https://travis-ci.org/htfy96/network_algo.svg?branch=master)\n\nA fast, embedded network framework.\n\n*Still under development. The following building steps won't work now*\n\n \u003e **This project has been migrated to Gitlab for better buildbot and privacy protection.**: https://gitlab.com/htfy96/network_algo\n\n##Build\n```\ngit clone --recursive https://github.com/htfy96/network_algo.git\nsudo add-apt-repository ppa:ubuntu-toolchain-r/test -y\nsudo apt-get -qq update\nsudo apt-get install -y libmysqlclient-dev cmake libsqlite3-dev libleveldb-dev libprotobuf-dev protobuf-compiler libsnappy-dev\nsudo apt-get install gcc-5 g++-5 -y //GCC 5+ is required\nexport CXX=\"g++-5\" CC=\"gcc-5\"\n\ncd network_algo\nmkdir build \u0026\u0026 cd build\ncmake ..\nmake -j2\nsudo make install\n```\n\n##Usage\n###Define node and edge type\nSave\n```proto\nmessage Node\n{\n    required string id = 1; //must be named id and has type string\n    required double dummy = 2; //custom data\n    //...\n}\nmessage Edge\n{\n    required string id = 1; //required\n    required string from = 2; //required\n    required string to = 3; //required\n    required int32 dummy = 4; //custom data\n    //...\n}\n```\nto `graphproto.proto`. Then run `protoc graphproto.proto --cpp-out=/your-cpp-source-directory`,\n   and it will generate `graphproto.pb.h` and `graphproto.pb.cc`.\n\n###Use it in your program\n```cpp\n#include \"graphproto.pb.h\" // which defines class Node and Edge\n#include \u003cnetalgo/include/leveldbgraph.hpp\u003e\n#include \u003cnetalgo/include/graphdsl.hpp\u003e\n// N --\u003e M \u003c-- K\nusing namespace netalgo;\nusing namespace std;\nint main()\n{\n    LeveldbGraph\u003cNode, Edge, true\u003e graph(\"mygraph.db\");\n    //the third argument means \"directed\". true is the default value\n    Node n; n.set_id(\"N\"); n.set_dummy(2.33);\n    Node m; m.set_id(\"M\"); m.set_dummy(6.66);\n    Node k; k.set_id(\"K\"); k.set_dummy(-2.5);\n    Edge nm; nm.set_id(\"NtoM\"); nm.set_from(\"N\"); nm.set_to(\"M\"); nm.set_dummy(1);\n    Edge km; km.set_id(\"KtoM\"); km.set_from(\"K\"); km.set_to(\"M\"); km.set_dummy(2);\n    graph.setNode(n); graph.setNode(m); graph.setNode(k); //setEdge can be used in a similar way\n    vector\u003cEdge\u003e edgeVec; edgeVec.push_back(nm); edgeVec.push_back(km);\n    graph.setEdgesBundle(edgeVec); //setNodesBundle\n\n    auto start = graph.parse(\"match (a)-[e1]-\u003e(mid id=\"M\")\u003c-[e2]-(c) return a,e1,c\"_graphsql); // return an iterator\n    for (auto it=start; it!=graph.end(); ++it) //iterates over result set\n    {\n        cout \u003c\u003c it-\u003egetNode(\"a\").id() \u003c\u003c \" \" \u003c\u003c it-\u003egetNode(\"c\").id() \u003c\u003c endl; //N K\n        cout \u003c\u003c it-\u003egetEdge(\"e1\").dummy() \u003c\u003c endl; //1\n        Node a = it-\u003egetNode(\"a\");\n        std::set\u003cstd::string\u003e outEdges = graph.getOutEdges(a.id());\n        for (auto \u0026e: outEdges)\n        {\n            graph.removeEdge(e.id());\n        }\n    }\n\n    cout \u003c\u003c calcDensity(graph) \u003c\u003c endl; //use existing algorithm\n}\n```\n\n##LICENSE\nGPLv3, except those with special notes in header.\n\n \u003e This program is free software: you can redistribute it and/or modify\n it under the terms of the GNU General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n \u003e This program is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n GNU General Public License for more details.\n\n \u003e You should have received a copy of the GNU General Public License\n along with this program.  If not, see \u003chttp://www.gnu.org/licenses/\u003e.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhtfy96%2Fnetwork_algo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhtfy96%2Fnetwork_algo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhtfy96%2Fnetwork_algo/lists"}