class_docstr: Class representing a sequence of vertices in the graph.
  
  This class is most easily accessed by the C{vs} field of the
  L{Graph} object, which returns an ordered sequence of all vertices in
  the graph. The vertex sequence can be refined by invoking the
  L{VertexSeq.select()} method. L{VertexSeq.select()} can also be
  accessed by simply calling the L{VertexSeq} object.
  
  An alternative way to create a vertex sequence referring to a given
  graph is to use the constructor directly:
  
    >>> g = Graph.Full(3)
    >>> vs = VertexSeq(g)
    >>> restricted_vs = VertexSeq(g, [0, 1])
  
  The individual vertices can be accessed by indexing the vertex sequence
  object. It can be used as an iterable as well, or even in a list
  comprehension:
  
    >>> g=Graph.Full(3)
    >>> for v in g.vs:
    ...   v["value"] = v.index ** 2
    ...
    >>> [v["value"] ** 0.5 for v in g.vs]
    [0.0, 1.0, 2.0]
  
  The vertex set can also be used as a dictionary where the keys are the
  attribute names. The values corresponding to the keys are the values
  of the given attribute for every vertex selected by the sequence.
  
    >>> g=Graph.Full(3)
    >>> for idx, v in enumerate(g.vs):
    ...   v["weight"] = idx*(idx+1)
    ...
    >>> g.vs["weight"]
    [0, 2, 6]
    >>> g.vs.select(1,2)["weight"] = [10, 20]
    >>> g.vs["weight"]
    [0, 10, 20]
  
  If you specify a sequence that is shorter than the number of vertices in
  the VertexSeq, the sequence is reused:
  
    >>> g = Graph.Tree(7, 2)
    >>> g.vs["color"] = ["red", "green"]
    >>> g.vs["color"]
    ['red', 'green', 'red', 'green', 'red', 'green', 'red']
  
  You can even pass a single string or integer, it will be considered as a
  sequence of length 1:
  
    >>> g.vs["color"] = "red"
    >>> g.vs["color"]
    ['red', 'red', 'red', 'red', 'red', 'red', 'red']
  
  Some methods of the vertex sequences are simply proxy methods to the
  corresponding methods in the L{Graph} object. One such example is
  C{VertexSeq.degree()}:
  
    >>> g=Graph.Tree(7, 2)
    >>> g.vs.degree()
    [2, 3, 3, 1, 1, 1, 1]
    >>> g.vs.degree() == g.degree()
    True
docstr: Returns the first vertex of the vertex sequence that matches some
  criteria.
  
  The selection criteria are equal to the ones allowed by L{VertexSeq.select}.
  See L{VertexSeq.select} for more details.
  
  For instance, to find the first vertex with name C{foo} in graph C{g}:
  
      >>> g.vs.find(name="foo")            #doctest:+SKIP
  
  To find an arbitrary isolated vertex:
  
      >>> g.vs.find(_degree=0)             #doctest:+SKIP
docstr_tok: ["Returns","the","first","vertex","of","the","vertex","sequence","that","matches","some","criteria",".","The","selection","criteria","are","equal","to","the","ones","allowed","by","L","{","VertexSeq.select","}",".","See","L","{","VertexSeq.select","}","for","more","details",".","For","instance",",","to","find","the","first","vertex","with","name","C","{","foo","}","in","graph","C","{","g","}",":",">",">",">","g.vs.find","(","name=","''","foo","''",")","#","doctest",":","+SKIP","To","find","an","arbitrary","isolated","vertex",":",">",">",">","g.vs.find","(","_degree=0",")","#","doctest",":","+SKIP"]
code: def find(self, *args, **kwds):
      """Returns the first vertex of the vertex sequence that matches some
      criteria.
  
      The selection criteria are equal to the ones allowed by L{VertexSeq.select}.
      See L{VertexSeq.select} for more details.
  
      For instance, to find the first vertex with name C{foo} in graph C{g}:
  
          >>> g.vs.find(name="foo")            #doctest:+SKIP
  
      To find an arbitrary isolated vertex:
  
          >>> g.vs.find(_degree=0)             #doctest:+SKIP
      """
      # Shortcut: if "name" is in kwds, there are no positional arguments,
      # and the specified name is a string, we try that first because that
      # attribute is indexed. Note that we cannot do this if name is an
      # integer, because it would then translate to g.vs.select(name), which
      # searches by _index_ if the argument is an integer
      if not args:
          if "name" in kwds:
              name = kwds.pop("name")
          elif "name_eq" in kwds:
              name = kwds.pop("name_eq")
          else:
              name = None
  
          if name is not None:
              if isinstance(name, str):
                  args = [name]
              else:
                  # put back what we popped
                  kwds["name"] = name
  
      if args:
          # Selecting first based on positional arguments, then checking
          # the criteria specified by the (remaining) keyword arguments
          vertex = _VertexSeq.find(self, *args)
          if not kwds:
              return vertex
          vs = self.graph.vs.select(vertex.index)
      else:
          vs = self
  
      # Selecting based on keyword arguments
      vs = vs.select(**kwds)
      if vs:
          return vs[0]
      raise ValueError("no such vertex")
  
file_path: python-igraph/src/igraph/seq.py
imports: import operator
  from igraph._igraph import EdgeSeq, VertexSeq
label_desc: Use image node_id 2 for calling the VertexSeq obj's underlying member method code with example usage: obj.find() and returns: vs, vertex