{"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/subgraphormer-unifying-subgraph-gnns-and","title":"Subgraphormer: Unifying Subgraph GNNs and Graph Transformers via Graph Products","arxiv_id":"2402.08450","date":"2024-02-13","proceeding":null,"authors":["Guy Bar-Shalom","Beatrice Bevilacqua","Haggai Maron"],"abstract":"In the realm of Graph Neural Networks (GNNs), two exciting research directions have recently emerged: Subgraph GNNs and Graph Transformers. In this paper, we propose an architecture that integrates both approaches, dubbed Subgraphormer, which combines the enhanced expressive power, message-passing mechanisms, and aggregation schemes from Subgraph GNNs with attention and positional encodings, arguably the most important components in Graph Transformers. Our method is based on an intriguing new connection we reveal between Subgraph GNNs and product graphs, suggesting that Subgraph GNNs can be formulated as Message Passing Neural Networks (MPNNs) operating on a product of the graph with itself. We use this formulation to design our architecture: first, we devise an attention mechanism based on the connectivity of the product graph. Following this, we propose a novel and efficient positional encoding scheme for Subgraph GNNs, which we derive as a positional encoding for the product graph. Our experimental results demonstrate significant performance improvements over both Subgraph GNNs and Graph Transformers on a wide range of datasets.","url_abs":"https://arxiv.org/abs/2402.08450v2","url_pdf":"https://arxiv.org/pdf/2402.08450v2.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":"subgraphormer-unifying-subgraph-gnns-and","repo_url":"https://github.com/barsguy/subgraphormer","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2402.08450","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2402.08450"}},"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":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/barsguy/subgraphormer","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":9,"ran_violates":1,"unverified":3},"by_repo_kind":{"official":{"samples":13,"ran":10,"repositories":1}},"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":"0cff4ef795da61b0","entry":"exclude_indices_efficient","repo":"barsguy/subgraphormer","repo_kind":"official","path":"utils/preprocess.py","file_url":"https://github.com/barsguy/subgraphormer/blob/HEAD/utils/preprocess.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":"0cff4ef795da61b0"}},{"code_sha256_prefix":"d0664f0de7749db7","entry":"get_loss_func","repo":"barsguy/subgraphormer","repo_kind":"official","path":"utils/training.py","file_url":"https://github.com/barsguy/subgraphormer/blob/HEAD/utils/training.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":"d0664f0de7749db7"}},{"code_sha256_prefix":"642abf566264fd3f","entry":"get_optim_func","repo":"barsguy/subgraphormer","repo_kind":"official","path":"utils/training.py","file_url":"https://github.com/barsguy/subgraphormer/blob/HEAD/utils/training.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":"642abf566264fd3f"}},{"code_sha256_prefix":"800b168632a34d74","entry":"get_sched_func","repo":"barsguy/subgraphormer","repo_kind":"official","path":"utils/training.py","file_url":"https://github.com/barsguy/subgraphormer/blob/HEAD/utils/training.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":"800b168632a34d74"}},{"code_sha256_prefix":"d06e25f9691220a7","entry":"initialize_best_metrics","repo":"barsguy/subgraphormer","repo_kind":"official","path":"utils/my_logging.py","file_url":"https://github.com/barsguy/subgraphormer/blob/HEAD/utils/my_logging.py","link_basis":"harvester_set","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":"d06e25f9691220a7"}},{"code_sha256_prefix":"bb2d04f8c8fcd377","entry":"load_config","repo":"barsguy/subgraphormer","repo_kind":"official","path":"utils/arguments.py","file_url":"https://github.com/barsguy/subgraphormer/blob/HEAD/utils/arguments.py","link_basis":"harvester_set","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":"bb2d04f8c8fcd377"}},{"code_sha256_prefix":"3bb8ae1624199e4e","entry":"override_config_with_args","repo":"barsguy/subgraphormer","repo_kind":"official","path":"utils/arguments.py","file_url":"https://github.com/barsguy/subgraphormer/blob/HEAD/utils/arguments.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":"3bb8ae1624199e4e"}},{"code_sha256_prefix":"6580312c3a449688","entry":"sample_indices","repo":"barsguy/subgraphormer","repo_kind":"official","path":"utils/preprocess.py","file_url":"https://github.com/barsguy/subgraphormer/blob/HEAD/utils/preprocess.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":"6580312c3a449688"}},{"code_sha256_prefix":"7c508037b40522af","entry":"str2bool","repo":"barsguy/subgraphormer","repo_kind":"official","path":"utils/arguments.py","file_url":"https://github.com/barsguy/subgraphormer/blob/HEAD/utils/arguments.py","link_basis":"harvester_set","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"7c508037b40522af"}},{"code_sha256_prefix":"92a281b2818ac230","entry":"update_best_metrics","repo":"barsguy/subgraphormer","repo_kind":"official","path":"utils/my_logging.py","file_url":"https://github.com/barsguy/subgraphormer/blob/HEAD/utils/my_logging.py","link_basis":"harvester_set","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":"92a281b2818ac230"}},{"code_sha256_prefix":"e151850124831c8f","entry":"get_zinc12k_dataloader","repo":"barsguy/subgraphormer","repo_kind":"official","path":"utils/data.py","file_url":"https://github.com/barsguy/subgraphormer/blob/HEAD/utils/data.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":"e151850124831c8f"}},{"code_sha256_prefix":"e0d56ad529d1d5bd","entry":"get_zincfull_dataloader","repo":"barsguy/subgraphormer","repo_kind":"official","path":"utils/data.py","file_url":"https://github.com/barsguy/subgraphormer/blob/HEAD/utils/data.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":"e0d56ad529d1d5bd"}},{"code_sha256_prefix":"fbdb0d1a2936ebf7","entry":"subgraph_construction","repo":"barsguy/subgraphormer","repo_kind":"official","path":"utils/preprocess.py","file_url":"https://github.com/barsguy/subgraphormer/blob/HEAD/utils/preprocess.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":"fbdb0d1a2936ebf7"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}