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.

utils.py 2.1 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. """
  4. Created on Wed Apr 1 15:12:31 2020
  5. @author: ljia
  6. """
  7. def constant_node_costs(edit_cost_name):
  8. if edit_cost_name == 'NON_SYMBOLIC' or edit_cost_name == 'LETTER2' or edit_cost_name == 'LETTER':
  9. return False
  10. # elif edit_cost_name != '':
  11. # # throw ged::Error("Invalid dataset " + dataset + ". Usage: ./median_tests <AIDS|Mutagenicity|Letter-high|Letter-med|Letter-low|monoterpenoides|SYNTHETICnew|Fingerprint|COIL-DEL>");
  12. # return False
  13. # return True
  14. def mge_options_to_string(options):
  15. opt_str = ' '
  16. for key, val in options.items():
  17. if key == 'init_type':
  18. opt_str += '--init-type ' + str(val) + ' '
  19. elif key == 'random_inits':
  20. opt_str += '--random-inits ' + str(val) + ' '
  21. elif key == 'randomness':
  22. opt_str += '--randomness ' + str(val) + ' '
  23. elif key == 'verbose':
  24. opt_str += '--stdout ' + str(val) + ' '
  25. elif key == 'refine':
  26. opt_str += '--refine ' + ('TRUE' if val else 'FALSE') + ' '
  27. elif key == 'time_limit':
  28. opt_str += '--time-limit ' + str(val) + ' '
  29. elif key == 'max_itrs':
  30. opt_str += '--max-itrs ' + str(val) + ' '
  31. elif key == 'max_itrs_without_update':
  32. opt_str += '--max-itrs-without-update ' + str(val) + ' '
  33. elif key == 'seed':
  34. opt_str += '--seed ' + str(val) + ' '
  35. elif key == 'epsilon':
  36. opt_str += '--epsilon ' + str(val) + ' '
  37. elif key == 'inits_increase_order':
  38. opt_str += '--inits-increase-order ' + str(val) + ' '
  39. elif key == 'init_type_increase_order':
  40. opt_str += '--init-type-increase-order ' + str(val) + ' '
  41. elif key == 'max_itrs_increase_order':
  42. opt_str += '--max-itrs-increase-order ' + str(val) + ' '
  43. # else:
  44. # valid_options = '[--init-type <arg>] [--random_inits <arg>] [--randomness <arg>] [--seed <arg>] [--verbose <arg>] '
  45. # valid_options += '[--time_limit <arg>] [--max_itrs <arg>] [--epsilon <arg>] '
  46. # valid_options += '[--inits_increase_order <arg>] [--init_type_increase_order <arg>] [--max_itrs_increase_order <arg>]'
  47. # raise Exception('Invalid option "' + key + '". Options available = "' + valid_options + '"')
  48. return opt_str

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