2

I understand that from here and the docs that find_vertex runs at O(N). I'm using the function to check if a vertex with a String property I'm adding already exists. Is this the optimal method to check if a graph already contains a vertex with a string property?

I'm trying to figure if I can use Property Maps like a dictionary to see if a string exists already before adding a vertex. Is it possible to access a Property Map by its value rather than its key since my Property Map values are unique anyway?

Francis
  • 137
  • 1
  • 10

1 Answers1

1

As recommended in the answer of your linked question, a faster option is to create a python dict to store string and vertex pairs. Then you only need O(1) for the check.

Sparky05
  • 4,692
  • 1
  • 10
  • 27