{"id":13481516,"url":"https://github.com/BorgwardtLab/graph-kernels","last_synced_at":"2025-03-27T12:30:58.994Z","repository":{"id":69455212,"uuid":"45589305","full_name":"BorgwardtLab/graph-kernels","owner":"BorgwardtLab","description":"Graph kernels","archived":false,"fork":false,"pushed_at":"2021-12-21T10:02:37.000Z","size":767,"stargazers_count":56,"open_issues_count":0,"forks_count":26,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-20T10:37:14.648Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BorgwardtLab.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}},"created_at":"2015-11-05T05:15:48.000Z","updated_at":"2024-12-24T14:24:50.000Z","dependencies_parsed_at":"2024-01-17T16:08:27.970Z","dependency_job_id":"c8f1eaa5-d6ff-40f9-850b-ac9ce707f906","html_url":"https://github.com/BorgwardtLab/graph-kernels","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/BorgwardtLab%2Fgraph-kernels","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BorgwardtLab%2Fgraph-kernels/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BorgwardtLab%2Fgraph-kernels/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BorgwardtLab%2Fgraph-kernels/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BorgwardtLab","download_url":"https://codeload.github.com/BorgwardtLab/graph-kernels/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245844842,"owners_count":20681789,"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-07-31T17:00:52.458Z","updated_at":"2025-03-27T12:30:58.640Z","avatar_url":"https://github.com/BorgwardtLab.png","language":"C++","funding_links":[],"categories":["Graph Kernels"],"sub_categories":[],"readme":"# Graph Kernels\nA fast C++ implementation of graph kernels including:\n* simple kernels between vertex and/or edge label histograms,\n* random walk kernels (popular baselines), and\n* the Weisfeiler-Lehman graph kernel (state-of-the-art).\n\nPlease see the following paper for more details:\n* Sugiyama, M., Borgwardt, K. M.: **Halting in Random Walk Kernels**, *Advances in Neural Information Processing Systems (NIPS 2015)*, 2015 [[PDF]](https://papers.nips.cc/paper/5688-halting-in-random-walk-kernels.pdf)\n\nOther implementations of graph kernels and graph benchmark datasets are available [here](https://www.bsse.ethz.ch/mlcb/research/machine-learning/graph-kernels.html).\n\n## Usage\n### In your program\nYou can compute the full kernel matrix by calling the function `graphKernelMatrix`.\nTo use it, you just need to include the header file \"graphKernels.h\" in your program.\nThe [Eigen](http://eigen.tuxfamily.org) and [igraph](http://igraph.org/c/) libraries are needed.\n\nThe main function `graphKernelMatrix` is defined as:\n```\nvoid graphKernelMatrix(vector\u003cigraph_t\u003e\u0026 g, vector\u003cdouble\u003e\u0026 par,\n                       string\u0026 kernel_name, MatrixXd\u0026 K);\n```\n* `g`: a vector of input graphs\n* `par`: a vector of parameters\n* `kernel_name`: a string to specify a kernel (see the list below)\n* `K`: the full kernel matrix will be returned here\n\n### In terminal\nTo try the code, we also provide a graph benchmark dataset \"mutag\" and a test code \"graphKernels_test.cc\", which includes input and output interface for graph files.\n\nFor example:\n```\n$ cd src/cc\n$ make\n$ ./gkernel -k kR -p 1,2,1 -i ../../data/mutag.list -g ../../data/mutag/ -o mutag_kR.kernel\n\u003e Reading files ... end\n\u003e Information:\n  Kernel:    k-step random walk kernel\n  Parameter: k = 3, lambda = (1, 2, 1)\n  Number of graphs: 188\n  The average number of vertices: 17.9309\n  The maximum number of vertices: 28\n  The average number of edges:    19.7926\n  The maximum number of edges:    33\n\u003e Computing the kernel matrix ... end\n  Runtime for the kernel matrix computation: 2.9501 (sec.)\n\u003e Writing the kernel matrix to \"mutag_kR.kernel\" ... end\n$ ./gkernel -k WL -p 5 -i ../../data/mutag.list -g ../../data/mutag/ -o mutag_WL.kernel\n\u003e Reading files ... end\n\u003e Information:\n  Kernel:    Weisfeiler-Lehman kernel\n  Parameter: h = 5\n  Number of graphs: 188\n  The average number of vertices: 17.9309\n  The maximum number of vertices: 28\n  The average number of edges:    19.7926\n  The maximum number of edges:    33\n\u003e Computing the kernel matrix ... end\n  Runtime for the kernel matrix computation: 0.00567007 (sec.)\n\u003e Writing the kernel matrix to \"mutag_WL.kernel\" ... end\n```\nTo compile the program, please edit paths in the \"Makefile\" according to the location of Eigen and igraph libraries in your environment.\n\n#### Command-line arguments\n\n  `-k \u003ckernel_name\u003e` : An abbreviated kernel name (see the list below)  \n  `-p \u003cparameter\u003e` : Parameter(s) in a kernel (if there are more than two, they should be comma-separated)  \n  `-i \u003cinput_file_list\u003e` : A file describing the list of graph file names  \n  `-g \u003cinput_file_path\u003e` : A path to the directory of graph files (the GraphML format is supported)  \n  `-o \u003coutput_file\u003e` : An output file of the full kernel matrix\n\n\n\n\n## List of graph kernels\nThe following graph kernels are supported:  \nThe second column (Abbrev.) is used for the third argument of `graphKernelMatrix`.\n\nKernels                                            | Abbrev. | Parameter\n-------------------------------------------------- | ------- | ---------\nLinear kernel between vertex histograms            |       V | None\nLinear kernel between edge histograms              |       E | None\nLinear kernel between vertex-edge histograms       |      VE | None\nLinear kernel combination (V + \u0026#955;VE)           |       H | \u0026#955;\nGaussian RBF kernel between vertex histograms      |      VG | \u0026#963;\nGaussian RBF kernel between edge histograms        |      EG | \u0026#963;\nGaussian RBF kernel between vertex-edge histograms |     VEG | \u0026#963;\nGeometric random walk kernel                       |      GR | \u0026#955;\nExponential random walk kernel                     |      ER | \u0026#946;\nk-step random walk kernel                          |      kR | \u0026#955;0, \u0026#955;1, ..., \u0026#955;k\nWeisfeiler-Lehman subtree kernel                   |      WL | h\n\n## Acknowledgements\nThe development of the graphkernels open access software package was financially supported by the Horizon 2020/CDS-QUAMRI/634541 project.\nThis support is gratefully acknowledged.\n\n## Contact\nAuthor: Mahito Sugiyama  \nAffiliation: National Institute of Informatics, Japan  \nE-mail: mahito@nii.ac.jp\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBorgwardtLab%2Fgraph-kernels","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FBorgwardtLab%2Fgraph-kernels","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBorgwardtLab%2Fgraph-kernels/lists"}