class_docstr: A matching of vertices in a graph.
  
  A matching of an undirected graph is a set of edges such that each
  vertex is incident on at most one matched edge. When each vertex is
  incident on I{exactly} one matched edge, the matching called
  I{perfect}. This class is used in C{igraph} to represent non-perfect
  and perfect matchings in undirected graphs.
  
  This class is usually not instantiated directly, everything
  is taken care of by the functions that return matchings.
  
  Examples:
  
    >>> from igraph import Graph
    >>> g = Graph.Famous("noperfectmatching")
    >>> matching = g.maximum_matching()
class_docstr_tok: ["A","matching","of","vertices","in","a","graph",".","A","matching","of","an","undirected","graph","is","a","set","of","edges","such","that","each","vertex","is","incident","on","at","most","one","matched","edge",".","When","each","vertex","is","incident","on","I","{","exactly","}","one","matched","edge",",","the","matching","called","I","{","perfect","}",".","This","class","is","used","in","C","{","igraph","}","to","represent","non-perfect","and","perfect","matchings","in","undirected","graphs",".","This","class","is","usually","not","instantiated","directly",",","everything","is","taken","care","of","by","the","functions","that","return","matchings",".","Examples",":",">",">",">","from","igraph","import","Graph",">",">",">","g","=","Graph.Famous","(","``","noperfectmatching","''",")",">",">",">","matching","=","g.maximum_matching","(",")"]
docstr: Sets the matching vector.
  
  @param value: the matching vector which must contain the ID of the
    vertex matching vertex I{i} at the I{i}th position, or C{-1} if
    the vertex is unmatched.
  @raise ValueError: if the matching vector supplied does not describe
    a valid matching of the graph.
docstr_tok: ["Sets","the","matching","vector",".","@","param","value",":","the","matching","vector","which","must","contain","the","ID","of","the","vertex","matching","vertex","I","{","i","}","at","the","I","{","i","}","th","position",",","or","C","{","-1","}","if","the","vertex","is","unmatched",".","@","raise","ValueError",":","if","the","matching","vector","supplied","does","not","describe","a","valid","matching","of","the","graph","."]
code: def matching(self, value):
      """Sets the matching vector.
  
      @param value: the matching vector which must contain the ID of the
        vertex matching vertex I{i} at the I{i}th position, or C{-1} if
        the vertex is unmatched.
      @raise ValueError: if the matching vector supplied does not describe
        a valid matching of the graph.
      """
      if not self.graph._is_matching(value, types=self._types):
          raise ValueError("not a valid matching")
      self._matching = list(value)
      self._num_matched = sum(1 for i in self._matching if i >= 0) // 2
  
file_path: python-igraph/src/igraph/matching.py
imports: from igraph._igraph import Vertex
label_desc: Use image node_id 11 for calling the Matching obj's underlying member method code with example usage: obj.matching(value) without return types