Skip to main content

Generalized Shortest Path Kernel on Graphs

Part of the Lecture Notes in Computer Science book series (LNAI,volume 9356)


We consider the problem of classifying graphs using graph kernels. We define a new graph kernel, called the generalized shortest path kernel, based on the number and length of shortest paths between nodes. For our example classification problem, we consider the task of classifying random graphs from two well-known families, by the number of clusters they contain. We verify empirically that the generalized shortest path kernel outperforms the original shortest path kernel on a number of datasets. We give a theoretical analysis for explaining our experimental results. In particular, we estimate distributions of the expected feature vectors for the shortest path kernel and the generalized shortest path kernel, and we show some evidence explaining why our graph kernel outperforms the shortest path kernel for our graph classification problem.


  • Graph kernel
  • SVM
  • Machine learning
  • Shortest path

This is a preview of subscription content, access via your institution.

Buying options

USD   29.95
Price excludes VAT (USA)
  • DOI: 10.1007/978-3-319-24282-8_8
  • Chapter length: 8 pages
  • Instant PDF download
  • Readable on all devices
  • Own it forever
  • Exclusive offer for individuals only
  • Tax calculation will be finalised during checkout
USD   54.99
Price excludes VAT (USA)
  • ISBN: 978-3-319-24282-8
  • Instant PDF download
  • Readable on all devices
  • Own it forever
  • Exclusive offer for individuals only
  • Tax calculation will be finalised during checkout
Softcover Book
USD   69.99
Price excludes VAT (USA)
Fig. 1.


  1. 1.

    This smallness assumption is for our analysis, and we believe that the situation is more or less the same for any d.


  1. Bilgin, C., Demir, C., Nagi, C., Yener, B.: Cell-graph mining for breast tissue modeling and classification. In: 29th Annual International Conference of the IEEE Engineering in Medicine and Biology Society, EMBS 2007, pp. 5311–5314. IEEE (2007)

    Google Scholar 

  2. Bollobás, B.: Random Graphs. Springer, New York (1998)

    CrossRef  MATH  Google Scholar 

  3. Borgwardt, K.M., Kriegel, H.-P.: Shortest-path kernels on graphs. In: Proceedings of ICDM (2005)

    Google Scholar 

  4. Borgwardt, K.M., Ong, C.S., Schönauer, S., Vishwanathan, S., Smola, A.J., Kriegel, H.-P.: Protein function prediction via graph kernels. Bioinformatics 21(suppl 1), i47–i56 (2005)

    CrossRef  Google Scholar 

  5. Fronczak, A., Fronczak, P., Hołyst, J.A.: Average path length in random networks. Phys. Rev. E 70(5), 056110 (2004)

    CrossRef  MATH  Google Scholar 

  6. Gärtner, T., Flach, P.A., Wrobel, S.: On graph kernels: hardness results and efficient alternatives. In: Schölkopf, B., Warmuth, M.K. (eds.) COLT/Kernel 2003. LNCS (LNAI), vol. 2777, pp. 129–143. Springer, Heidelberg (2003)

    CrossRef  Google Scholar 

  7. Havlin, S., Ben-Avraham, D.: Theoretical and numerical study of fractal dimensionality in self-avoiding walks. Phys. Rev. A 26(3), 1728 (1982)

    MathSciNet  CrossRef  Google Scholar 

  8. Hermansson, L., Kerola, T., Johansson, F., Jethava, V., Dubhashi, D.: Entity disambiguation in anonymized graphs using graph kernels. In: Proceedings of the 22nd ACM International Conference on Conference on Information and Knowledge Management, pp. 1037–1046. ACM (2013)

    Google Scholar 

  9. Johansson, F., Jethava, V., Dubhashi, D., Bhattacharyya, C.: Global graph kernels using geometric embeddings. In: Proceedings of the 31st International Conference on Machine Learning (ICML-14), pp. 694–702 (2014)

    Google Scholar 

  10. Kolla, S.D.A., Koiliaris, K.: Spectra of random graphs with planted partitions (2013)

    Google Scholar 

  11. Kudo, T., Maeda, E., Matsumoto, Y.: An application of boosting to graph classification. In: Advances in Neural Information Processing Systems, pp. 729–736 (2004)

    Google Scholar 

  12. Liśkiewicz, M., Ogihara, M., Toda, S.: The complexity of counting self-avoiding walks in subgraphs of two-dimensional grids and hypercubes. Theor. Comput. Sci. 304(1), 129–156 (2003)

    MathSciNet  CrossRef  MATH  Google Scholar 

  13. Shalev-Shwartz, S., Singer, Y., Srebro, N., Cotter, A.: Pegasos: primal estimated sub-gradient solver for SVM. Math. Program. 127(1), 3–30 (2011)

    MathSciNet  CrossRef  MATH  Google Scholar 

  14. Shervashidze, N., Vishwanathan, S., Petri, T., Mehlhorn, K., Borgwardt, K.M.: Efficient graphlet kernels for large graph comparison. In Proceedings of AISTATS (2009)

    Google Scholar 

Download references


This work is supported in part by the ELC project (MEXT KAKENHI No. 24106008) and also in part by the Swedish Foundation for Strategic Research.

Author information

Authors and Affiliations


Corresponding author

Correspondence to Linus Hermansson .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and Permissions

Copyright information

© 2015 Springer International Publishing Switzerland

About this paper

Cite this paper

Hermansson, L., Johansson, F.D., Watanabe, O. (2015). Generalized Shortest Path Kernel on Graphs. In: Japkowicz, N., Matwin, S. (eds) Discovery Science. DS 2015. Lecture Notes in Computer Science(), vol 9356. Springer, Cham.

Download citation

  • DOI:

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-24281-1

  • Online ISBN: 978-3-319-24282-8

  • eBook Packages: Computer ScienceComputer Science (R0)