{"id":22229784,"url":"https://github.com/graph-com/multi-q-maglap","last_synced_at":"2025-10-13T08:30:36.600Z","repository":{"id":241606019,"uuid":"807191099","full_name":"Graph-COM/Multi-q-Maglap","owner":"Graph-COM","description":null,"archived":false,"fork":false,"pushed_at":"2024-05-28T16:27:41.000Z","size":10588,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-06T05:51:10.170Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Graph-COM.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-05-28T16:21:34.000Z","updated_at":"2025-03-13T14:01:11.000Z","dependencies_parsed_at":"2024-05-29T08:44:49.728Z","dependency_job_id":null,"html_url":"https://github.com/Graph-COM/Multi-q-Maglap","commit_stats":null,"previous_names":["graph-com/multi-q-maglap"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Graph-COM/Multi-q-Maglap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Graph-COM%2FMulti-q-Maglap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Graph-COM%2FMulti-q-Maglap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Graph-COM%2FMulti-q-Maglap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Graph-COM%2FMulti-q-Maglap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Graph-COM","download_url":"https://codeload.github.com/Graph-COM/Multi-q-Maglap/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Graph-COM%2FMulti-q-Maglap/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279014326,"owners_count":26085492,"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","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-12-03T01:12:25.373Z","updated_at":"2025-10-13T08:30:32.642Z","avatar_url":"https://github.com/Graph-COM.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# What Are Good Positional Encodings for Directed Graphs?\n\nThis is the official implementation for *Multi-q Magnetic Laplacian Positional Encodings* proposed in paper \"What Are Good Positional Encodings for\nDirected Graphs\".\n\nFeel free to contact yhuang903@gatech.edu if there is any question.\n\n\n## Paper Overview \nPositional encodings (PE) for graphs are essential in constructing powerful and\nexpressive graph neural networks and graph transformers as they effectively capture\nrelative spatial relations between nodes. While PEs for undirected graphs have\nbeen extensively studied, those for directed graphs remain largely unexplored,\ndespite the fundamental role of directed graphs in representing entities with strong\nlogical dependencies, such as those in program analysis and circuit designs. This\nwork studies the design of PEs for directed graphs that are expressive to represent\ndesired directed spatial relations. We first propose walk profile, a generalization of\nwalk counting sequence to directed graphs. We identify limitations in existing PE\nmethods—including symmetrized Laplacian PE, Singular Value Decomposition\nPE, and Magnetic Laplacian PE—in their ability to express walk profiles. To\naddress these limitations, we propose the Multi-q Magnetic Laplacian PE, which\nextends Magnetic Laplacian PE with multiple potential factors. This simple variant\nturns out to be capable of provably expressing walk profiles. Furthermore, we\ngeneralize previous basis-invariant and stable networks to handle complex-domain\nPEs decomposed from Magnetic Laplacians. Our numerical experiments demon-\nstrate the effectiveness of Multi-q Magnetic Laplacian PE with a stable neural\narchitecture, outperforming previous PE methods (with stable networks) on predict-\ning directed distances/walk profiles, sorting network satisfiability, and on general\ncircuit benchmarks.\n\n\n## Code Usage\n### Requirement\nSee ``requirements.txt``\n\n### Distance Prediction\n\n**Dataset generation.** To generate the dataset, step into ``./data_utils`` and run\n```\npython generate_random_graphs.py --out_path=../data/distance/ --connected --acyclic --n_train=16,64 --n_valid=64,72 --n_test=72,84\n```\nto generate directed acyclic graphs. To generate regular directed graphs, remove '--acyclic'. By default the node pairs are lalelled with shortest path distance. \nTo generate longest path distance or walk profile, set DIST='lpd' or 'wp' at Line 41 of generate_random_graphs.py. \n\n\nAfter finishing dataset generation, run ``run_ca_spd.sh`` to reproduce the shortest path distance results for Multi-q Mag-PE on connected, acyclic directed graphs. \nOthers scripts ``run_ca_lpd.sh``, ``run_ca_wp.sh``, ``run_c_spd.sh``,``run_c_lpd.sh``,``run_c_wp.sh`` can reproduce other results correspondingly.\n\n\n### Sorting Network\n**Dataset generation.** To generate the dataset, step into ``./data_utils`` and run\n```\npython generate_sorting.py\n```\n\nAfter finish dataset generation, run ``run_sort.sh`` to reproduce the result of Multi-q Mag-PE.\n\n\n\n### Circuit Property Prediction\nThe code for this part is in an independent directory ``./EDA_benchmark``. Step into `./EDA_benchmark` as the first step.\n\nTo reproduce the results of Open Circuit Benchmark, run ``run_amp.sh``. By default the target is Gain and backbone GNN is BIGINE. To get results of other targets, \nset ``target=bw`` or ``target=pm`` at Line 5 of ``run_amp.sh``. To change backbone GNN to GINE, set ``gine_config=gine_10q001``.\n\n\nTo reproduce the results of High-level synthesis, run ``run_hls.sh``.\n\n\n ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraph-com%2Fmulti-q-maglap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgraph-com%2Fmulti-q-maglap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraph-com%2Fmulti-q-maglap/lists"}