You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

edit_cost.py 2.1 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. """
  4. Created on Wed Jun 17 17:49:24 2020
  5. @author: ljia
  6. """
  7. class EditCost(object):
  8. def __init__(self):
  9. pass
  10. def node_ins_cost_fun(self, node_label):
  11. """
  12. /*!
  13. * @brief Node insertions cost function.
  14. * @param[in] node_label A node label.
  15. * @return The cost of inserting a node with label @p node_label.
  16. * @note Must be implemented by derived classes of ged::EditCosts.
  17. */
  18. """
  19. return 0
  20. def node_del_cost_fun(self, node_label):
  21. """
  22. /*!
  23. * @brief Node deletion cost function.
  24. * @param[in] node_label A node label.
  25. * @return The cost of deleting a node with label @p node_label.
  26. * @note Must be implemented by derived classes of ged::EditCosts.
  27. */
  28. """
  29. return 0
  30. def node_rel_cost_fun(self, node_label_1, node_label_2):
  31. """
  32. /*!
  33. * @brief Node relabeling cost function.
  34. * @param[in] node_label_1 A node label.
  35. * @param[in] node_label_2 A node label.
  36. * @return The cost of changing a node's label from @p node_label_1 to @p node_label_2.
  37. * @note Must be implemented by derived classes of ged::EditCosts.
  38. */
  39. """
  40. return 0
  41. def edge_ins_cost_fun(self, edge_label):
  42. """
  43. /*!
  44. * @brief Edge insertion cost function.
  45. * @param[in] edge_label An edge label.
  46. * @return The cost of inserting an edge with label @p edge_label.
  47. * @note Must be implemented by derived classes of ged::EditCosts.
  48. */
  49. """
  50. return 0
  51. def edge_del_cost_fun(self, edge_label):
  52. """
  53. /*!
  54. * @brief Edge deletion cost function.
  55. * @param[in] edge_label An edge label.
  56. * @return The cost of deleting an edge with label @p edge_label.
  57. * @note Must be implemented by derived classes of ged::EditCosts.
  58. */
  59. """
  60. return 0
  61. def edge_rel_cost_fun(self, edge_label_1, edge_label_2):
  62. """
  63. /*!
  64. * @brief Edge relabeling cost function.
  65. * @param[in] edge_label_1 An edge label.
  66. * @param[in] edge_label_2 An edge label.
  67. * @return The cost of changing an edge's label from @p edge_label_1 to @p edge_label_2.
  68. * @note Must be implemented by derived classes of ged::EditCosts.
  69. */
  70. """
  71. return 0

A Python package for graph kernels, graph edit distances and graph pre-image problem.