{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/a-neural-framework-for-learning-subgraph-and","title":"GREED: A Neural Framework for Learning Graph Distance Functions","arxiv_id":"2112.13143","date":"2021-12-24","proceeding":null,"authors":["Rishabh Ranjan","Siddharth Grover","Sourav Medya","Venkatesan Chakaravarthy","Yogish Sabharwal","Sayan Ranu"],"abstract":"Among various distance functions for graphs, graph and subgraph edit distances (GED and SED respectively) are two of the most popular and expressive measures. Unfortunately, exact computations for both are NP-hard. To overcome this computational bottleneck, neural approaches to learn and predict edit distance in polynomial time have received much interest. While considerable progress has been made, there exist limitations that need to be addressed. First, the efficacy of an approximate distance function lies not only in its approximation accuracy, but also in the preservation of its properties. To elaborate, although GED is a metric, its neural approximations do not provide such a guarantee. This prohibits their usage in higher order tasks that rely on metric distance functions, such as clustering or indexing. Second, several existing frameworks for GED do not extend to SED due to SED being asymmetric. In this work, we design a novel siamese graph neural network called GREED, which through a carefully crafted inductive bias, learns GED and SED in a property-preserving manner. Through extensive experiments across 10 real graph datasets containing up to 7 million edges, we establish that GREED is not only more accurate than the state of the art, but also up to 3 orders of magnitude faster. Even more significantly, due to preserving the triangle inequality, the generated embeddings are indexable and consequently, even in a CPU-only environment, GREED is up to 50 times faster than GPU-powered baselines for graph / subgraph retrieval.","url_abs":"https://arxiv.org/abs/2112.13143v3","url_pdf":"https://arxiv.org/pdf/2112.13143v3.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"a-neural-framework-for-learning-subgraph-and","repo_url":"https://github.com/idea-iitd/neurosed","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"a-neural-framework-for-learning-subgraph-and","repo_url":"https://github.com/idea-iitd/greed","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":null,"task_name":"CPU"},{"task_slug":null,"task_name":"GPU"},{"task_slug":"graph-neural-network","task_name":"Graph Neural Network"},{"task_slug":"graph-similarity","task_name":"Graph Similarity"},{"task_slug":"inductive-bias","task_name":"Inductive Bias"},{"task_slug":"retrieval","task_name":"Retrieval"}],"methods":[{"method_slug":"graph-neural-network","method_name":"Graph Neural Network"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":null,"atlas_url":"https://app.syntology.ai/?focus=2112.13143","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2112.13143"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"deterministic:regex_extraction","url":"https://github.com/idea-iitd/greed","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/idea-iitd/neurosed","reach":null}],"summary":{"ran":2,"unverified":13},"by_repo_kind":{"official":{"samples":15,"ran":2,"repositories":2}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"24e67ae2ebba81da","entry":"EmbedModel","repo":"idea-iitd/neurosed","repo_kind":"official","path":"neuro/models.py","file_url":"https://github.com/idea-iitd/neurosed/blob/HEAD/neuro/models.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"24e67ae2ebba81da"}},{"code_sha256_prefix":"6be2041a0ee69000","entry":"SiameseModel","repo":"idea-iitd/neurosed","repo_kind":"official","path":"neuro/models.py","file_url":"https://github.com/idea-iitd/neurosed/blob/HEAD/neuro/models.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"6be2041a0ee69000"}},{"code_sha256_prefix":"1c519e2c43db9290","entry":"NeuralSiameseModel","repo":"idea-iitd/neurosed","repo_kind":"official","path":"neuro/models.py","file_url":"https://github.com/idea-iitd/neurosed/blob/HEAD/neuro/models.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"1c519e2c43db9290"}},{"code_sha256_prefix":"37246958bf6c1aec","entry":"batch_of_dataset","repo":"idea-iitd/greed","repo_kind":"official","path":"neuro/utils.py","file_url":"https://github.com/idea-iitd/greed/blob/HEAD/neuro/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"37246958bf6c1aec"}},{"code_sha256_prefix":"cb067683b0ecbb1b","entry":"err","repo":"idea-iitd/greed","repo_kind":"official","path":"neuro/metrics.py","file_url":"https://github.com/idea-iitd/greed/blob/HEAD/neuro/metrics.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"cb067683b0ecbb1b"}},{"code_sha256_prefix":"cc5d89845905b06b","entry":"k_hop_nbr_func","repo":"idea-iitd/greed","repo_kind":"official","path":"neuro/datasets.py","file_url":"https://github.com/idea-iitd/greed/blob/HEAD/neuro/datasets.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"cc5d89845905b06b"}},{"code_sha256_prefix":"ba67b4e72ce713f6","entry":"k_hop_nbr_nx","repo":"idea-iitd/greed","repo_kind":"official","path":"neuro/datasets.py","file_url":"https://github.com/idea-iitd/greed/blob/HEAD/neuro/datasets.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"ba67b4e72ce713f6"}},{"code_sha256_prefix":"f37d5e53c04dea18","entry":"label_graphs","repo":"idea-iitd/greed","repo_kind":"official","path":"neuro/utils.py","file_url":"https://github.com/idea-iitd/greed/blob/HEAD/neuro/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"f37d5e53c04dea18"}},{"code_sha256_prefix":"706a15018478eff5","entry":"mse","repo":"idea-iitd/greed","repo_kind":"official","path":"neuro/metrics.py","file_url":"https://github.com/idea-iitd/greed/blob/HEAD/neuro/metrics.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"706a15018478eff5"}},{"code_sha256_prefix":"fe57c0339c66673f","entry":"preprocess","repo":"idea-iitd/greed","repo_kind":"official","path":"neuro/h2mn_utils.py","file_url":"https://github.com/idea-iitd/greed/blob/HEAD/neuro/h2mn_utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"fe57c0339c66673f"}},{"code_sha256_prefix":"339bda326bbc90d3","entry":"random_bfs_sample","repo":"idea-iitd/greed","repo_kind":"official","path":"neuro/datasets.py","file_url":"https://github.com/idea-iitd/greed/blob/HEAD/neuro/datasets.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"339bda326bbc90d3"}},{"code_sha256_prefix":"99e446f9903a7a19","entry":"sim_to_ged","repo":"idea-iitd/greed","repo_kind":"official","path":"neuro/h2mn_utils.py","file_url":"https://github.com/idea-iitd/greed/blob/HEAD/neuro/h2mn_utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"99e446f9903a7a19"}},{"code_sha256_prefix":"46d5d380b2a8610c","entry":"sim_to_sed","repo":"idea-iitd/greed","repo_kind":"official","path":"neuro/h2mn_utils.py","file_url":"https://github.com/idea-iitd/greed/blob/HEAD/neuro/h2mn_utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"46d5d380b2a8610c"}},{"code_sha256_prefix":"958f56a630836334","entry":"to_pyged","repo":"idea-iitd/greed","repo_kind":"official","path":"neuro/utils.py","file_url":"https://github.com/idea-iitd/greed/blob/HEAD/neuro/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"958f56a630836334"}},{"code_sha256_prefix":"c1ac97b5adf74a26","entry":"weighted_mse","repo":"idea-iitd/greed","repo_kind":"official","path":"neuro/metrics.py","file_url":"https://github.com/idea-iitd/greed/blob/HEAD/neuro/metrics.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"c1ac97b5adf74a26"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}