penman icon indicating copy to clipboard operation
penman copied to clipboard

Simple membership test: X in graph

Open goodmami opened this issue 8 years ago • 0 comments

It would be useful to have a simple way to test if a graph has certain elements. This would be done my implementing the __contains__() method on the Graph class.

I can imagine several behaviors based on the type of thing being checked:

  • string ('xyz' in g) - return True if the string is an attribute (i.e. terminal) value
  • Graph (Graph(...) in g) - return True if the query graph is isomorphic to a subgraph of g
  • tuple (('x', 'polarity', '-') in g) - return True if the query tuple is a triple in g

To start, maybe we should just consider string values.

goodmami avatar Mar 28 '17 06:03 goodmami