class_docstr: Class which stores vertex and edge properties that can be used to construct
  Graphs from individual property selections and used later to annotate graph
  algorithm results with corresponding properties.
class_docstr_tok: ["Class","which","stores","vertex","and","edge","properties","that","can","be","used","to","construct","Graphs","from","individual","property","selections","and","used","later","to","annotate","graph","algorithm","results","with","corresponding","properties","."]
docstr: Evaluate expr and return a PropertySelection object representing the
  vertices that match the expression.
  
  Parameters
  ----------
  expr : string
      A python expression using property names and operators to select
      specific vertices.
  from_previous_selection : PropertySelection, optional
      A PropertySelection instance returned from a prior call to
      select_vertices() that can be used to select a subset of vertices
      to evaluate the expression against. This allows for a selection of
      the intersection of vertices of multiple types (eg. all vertices
      that are both type A and type B)
  
  Returns
  -------
  PropertySelection
      used for calls to extract_subgraph()
      in order to construct a Graph containing only specific vertices.
  
  Examples
  --------
  >>> import cugraph
  >>> import cudf
  >>> from cugraph.experimental import PropertyGraph
  >>> df = cudf.DataFrame(columns=["src", "dst", "some_property"],
  ...                     data=[(99, 22, "a"),
  ...                           (98, 34, "b"),
  ...                           (97, 56, "c"),
  ...                           (96, 88, "d"),
  ...                          ])
  >>> pG = PropertyGraph()
  >>> pG.add_edge_data(df, type_name="etype", vertex_col_names=("src", "dst"))
  >>> vert_df = cudf.DataFrame({"vert_id": [99, 22, 98, 34, 97, 56, 96, 88],
  ...                           "v_prop": [1, 2, 3, 4, 5, 6, 7, 8]})
  >>> pG.add_vertex_data(vert_df, type_name="vtype", vertex_col_name="vert_id")
  >>> selection = pG.select_vertices("(_TYPE_ == 'vtype') & (v_prop > 4)")
  >>> G = pG.extract_subgraph(selection=selection)
  >>> print (G.number_of_vertices())
  4
code: def select_vertices(self, expr, from_previous_selection=None):
      """
      Evaluate expr and return a PropertySelection object representing the
      vertices that match the expression.
  
      Parameters
      ----------
      expr : string
          A python expression using property names and operators to select
          specific vertices.
      from_previous_selection : PropertySelection, optional
          A PropertySelection instance returned from a prior call to
          select_vertices() that can be used to select a subset of vertices
          to evaluate the expression against. This allows for a selection of
          the intersection of vertices of multiple types (eg. all vertices
          that are both type A and type B)
  
      Returns
      -------
      PropertySelection
          used for calls to extract_subgraph()
          in order to construct a Graph containing only specific vertices.
  
      Examples
      --------
      >>> import cugraph
      >>> import cudf
      >>> from cugraph.experimental import PropertyGraph
      >>> df = cudf.DataFrame(columns=["src", "dst", "some_property"],
      ...                     data=[(99, 22, "a"),
      ...                           (98, 34, "b"),
      ...                           (97, 56, "c"),
      ...                           (96, 88, "d"),
      ...                          ])
      >>> pG = PropertyGraph()
      >>> pG.add_edge_data(df, type_name="etype", vertex_col_names=("src", "dst"))
      >>> vert_df = cudf.DataFrame({"vert_id": [99, 22, 98, 34, 97, 56, 96, 88],
      ...                           "v_prop": [1, 2, 3, 4, 5, 6, 7, 8]})
      >>> pG.add_vertex_data(vert_df, type_name="vtype", vertex_col_name="vert_id")
      >>> selection = pG.select_vertices("(_TYPE_ == 'vtype') & (v_prop > 4)")
      >>> G = pG.extract_subgraph(selection=selection)
      >>> print (G.number_of_vertices())
      4
      """
      # FIXME: check types
  
      # Check if the expr is to be evaluated in the context of properties
      # from only the previously selected vertices (as opposed to all
      # properties from all vertices)
      if (
          from_previous_selection is not None
          and from_previous_selection.vertex_selections is not None
      ):
          previously_selected_rows = self.__vertex_prop_dataframe[
              from_previous_selection.vertex_selections
          ]
  
          rows_to_eval = self.__vertex_prop_dataframe.loc[
              previously_selected_rows.index
          ]
  
          locals = dict(
              [(n, rows_to_eval[n]) for n in rows_to_eval.columns]
          )
          locals[self.vertex_col_name] = rows_to_eval.index
      else:
          locals = self.__vertex_prop_eval_dict
  
      globals = {}
      selected_col = eval(expr, globals, locals)
  
      num_rows = len(self.__vertex_prop_dataframe)
      # Ensure the column is the same size as the DataFrame, then replace any
      # NA values with False to represent rows that should not be selected.
      # This ensures the selected column can be applied to the entire
      # __vertex_prop_dataframe to determine which rows to use when creating
      # a Graph from a query.
      if num_rows != len(selected_col):
          selected_col = selected_col.reindex(
              self.__vertex_prop_dataframe.index,
              fill_value=False,
              copy=False,
          )
  
      return EXPERIMENTAL__PropertySelection(
          vertex_selection_series=selected_col
      )
  
imports: import cudf
  import numpy
  import cugraph
  from cugraph.utilities.utils import import_optional, MissingModule, create_list_series_from_2d_ar
  from typing import Union
label_desc: Use image node_id 25 for calling the EXPERIMENTAL__PropertyGraph obj's underlying member method code with example usage: obj.select_vertices(expr, from_previous_selection) and returns: EXPERIMENTAL__PropertySelection