{"id":13481562,"url":"https://github.com/benedekrozemberczki/NestedSubtreeHash","last_synced_at":"2025-03-27T12:31:07.697Z","repository":{"id":102016589,"uuid":"148385634","full_name":"benedekrozemberczki/NestedSubtreeHash","owner":"benedekrozemberczki","description":"A distributed implementation of \"Nested Subtree Hash Kernels for Large-Scale Graph Classification Over Streams\" (ICDM 2012).","archived":false,"fork":false,"pushed_at":"2022-08-14T10:28:11.000Z","size":155,"stargazers_count":7,"open_issues_count":0,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-08-01T17:29:02.629Z","etag":null,"topics":["data-mining","data-science","deepwalk","distributed-machine-learning","feature-extraction","gensim","graph-classification","graph-kernel","graph-mining","hashing","large-scale-learning","machine-learning","multi-scale","node2vec","representation-learning","streaming-data","streaming-processing","word2vec"],"latest_commit_sha":null,"homepage":"","language":"Python","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/benedekrozemberczki.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":["benedekrozemberczki"]}},"created_at":"2018-09-11T22:01:57.000Z","updated_at":"2021-12-19T22:22:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"938cc245-d01d-47f2-ac7b-88cdfab4efc4","html_url":"https://github.com/benedekrozemberczki/NestedSubtreeHash","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/benedekrozemberczki%2FNestedSubtreeHash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benedekrozemberczki%2FNestedSubtreeHash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benedekrozemberczki%2FNestedSubtreeHash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benedekrozemberczki%2FNestedSubtreeHash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/benedekrozemberczki","download_url":"https://codeload.github.com/benedekrozemberczki/NestedSubtreeHash/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222251755,"owners_count":16955891,"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":["data-mining","data-science","deepwalk","distributed-machine-learning","feature-extraction","gensim","graph-classification","graph-kernel","graph-mining","hashing","large-scale-learning","machine-learning","multi-scale","node2vec","representation-learning","streaming-data","streaming-processing","word2vec"],"created_at":"2024-07-31T17:00:52.813Z","updated_at":"2024-10-30T15:31:03.609Z","avatar_url":"https://github.com/benedekrozemberczki.png","language":"Python","readme":"Nested Subtree Hashes\n====================\n[![codebeat badge](https://codebeat.co/badges/8ba4cc57-939e-40f9-ba71-ddf6b48a13eb)](https://codebeat.co/projects/github-com-benedekrozemberczki-nestedsubtreehash-master)  [![repo size](https://img.shields.io/github/repo-size/benedekrozemberczki/NestedSubtreeHash.svg)](https://github.com/benedekrozemberczki/NestedSubtreeHash/archive/master.zip) [![benedekrozemberczki](https://img.shields.io/twitter/follow/benrozemberczki?style=social\u0026logo=twitter)](https://twitter.com/intent/follow?screen_name=benrozemberczki)\n\n\n\u003cp align=\"justify\"\u003e\nNested subtree hashing is an embedding algorithm which learns representations for a set of graphs by hashing the Weisfeiler-Lehman subtree patterns. The procedure places graphs in an abstract feature space where graphs with similar structural properties (Weisfehler-Lehman features) are clustered together. Nested subtree hashing has a linear runtime complexity in the number of graphs in the dataset which makes it extremely scalable. At the instance level creating a graph representation has a linear runtime and space complexity in the number of edges. This specific implementation supports multi-core data processing in the feature extraction and hashing phases. (So far this is the only implementation which support multi-core processing in every phase).\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003cimg width=\"720\" src=\"graph_embedding.jpeg\"\u003e\n\u003c/p\u003e\n\nThis repository provides an implementation for Nested Subtree Hashing as it is described in:\n\u003e **Nested Subtree Hash Kernels for Large-scale Graph Classification Over Streams**\n\u003e Bin Li, Xingquan Zhu, Lianhua Chi, Chengqi Zhang\n\u003e IEEE 12th International Conference on Data Mining.\n\n### Requirements\n\nThe codebase is implemented in Python 3.5.2 | Anaconda 4.2.0 (64-bit). Package versions used for development are just below.\n```\nnetworkx          2.4\ntqdm              4.19.5\npandas            0.23.4\njsonschema        2.6.0\njoblib            0.13.0\nnumpy             1.15.4\ntexttable         1.5.0\n```\n\n### Datasets\n\u003cp align=\"justify\"\u003e\nThe code takes an input folder with json files. Every file is a graph and files have a numeric index as a name. The json files have two keys. The first key called \"edges\" corresponds to the edge list of the graph. The second key \"features\" corresponds to the node features. If the second key is not present the WL machine defaults to use the node degree as a feature.  A sample graph dataset from NCI1 is included in the `dataset/` directory.\n\u003c/p\u003e\n### Options\n\nLearning of the embedding is handled by the `src/main.py` script which provides the following command line arguments.\n\n#### Input and output options\n\n```\n  --input-path      STR     Input folder.         Default is `dataset/`.\n  --output-path     STR     Embeddings path.      Default is `features/nci1.csv`.\n```\n#### Model options\n```\n  --dimensions      INT     Number of dimensions.                          Default is 16.\n  --workers         INT     Number of workers.                             Default is 4.\n  --wl-iterations   INT     Number of feature extraction recursions.       Default is 2.\n```\n\n### Examples\n\nThe following commands learn an embedding of the graphs and writes it to disk. The node representations are ordered by the ID.\n\nCreating a Nested Subtree Hash embedding of the default dataset with the default hyperparameter settings. Saving the embedding at the default path.\n\n```\npython src/main.py\n```\n\nCreating an embedding of an other dataset. Saving the output in a custom place.\n\n```\npython src/main.py --input-path new_data/ --output-path features/nci2.csv\n```\n\nCreating an embedding of the default dataset with 3x32 dimensions as each recursion creates a 32 dimensional multi-scale subspace.\n\n```\npython src/main.py --dimensions 32 --wl-iterations 3\n```\n\n--------------------------------------------\n\n**License**\n\n- [GNU](https://github.com/benedekrozemberczki/NestedSubtreeHash/blob/master/LICENSE)\n\n---------------------------------------------\n","funding_links":["https://github.com/sponsors/benedekrozemberczki"],"categories":["Graph Kernels"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenedekrozemberczki%2FNestedSubtreeHash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbenedekrozemberczki%2FNestedSubtreeHash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenedekrozemberczki%2FNestedSubtreeHash/lists"}