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: Initializes the matching.
  
  @param graph: the graph the matching belongs to
  @param matching: a numeric vector where element I{i} corresponds to
    vertex I{i} of the graph. Element I{i} is -1 or if the corresponding
    vertex is unmatched, otherwise it contains the index of the vertex to
    which vertex I{i} is matched.
  @param types: the types of the vertices if the graph is bipartite.
    It must either be the name of a vertex attribute (which will be
    retrieved for all vertices) or a list. Elements in the list will be
    converted to boolean values C{True} or C{False}, and this will
    determine which part of the bipartite graph a given vertex belongs to.
  @raise ValueError: if the matching vector supplied does not describe
    a valid matching of the graph.
docstr_tok: ["Initializes","the","matching",".","@","param","graph",":","the","graph","the","matching","belongs","to","@","param","matching",":","a","numeric","vector","where","element","I","{","i","}","corresponds","to","vertex","I","{","i","}","of","the","graph",".","Element","I","{","i","}","is","-1","or","if","the","corresponding","vertex","is","unmatched",",","otherwise","it","contains","the","index","of","the","vertex","to","which","vertex","I","{","i","}","is","matched",".","@","param","types",":","the","types","of","the","vertices","if","the","graph","is","bipartite",".","It","must","either","be","the","name","of","a","vertex","attribute","(","which","will","be","retrieved","for","all","vertices",")","or","a","list",".","Elements","in","the","list","will","be","converted","to","boolean","values","C","{","True","}","or","C","{","False","}",",","and","this","will","determine","which","part","of","the","bipartite","graph","a","given","vertex","belongs","to",".","@","raise","ValueError",":","if","the","matching","vector","supplied","does","not","describe","a","valid","matching","of","the","graph","."]
code: def __init__(self, graph, matching, types=None):
      """Initializes the matching.
  
      @param graph: the graph the matching belongs to
      @param matching: a numeric vector where element I{i} corresponds to
        vertex I{i} of the graph. Element I{i} is -1 or if the corresponding
        vertex is unmatched, otherwise it contains the index of the vertex to
        which vertex I{i} is matched.
      @param types: the types of the vertices if the graph is bipartite.
        It must either be the name of a vertex attribute (which will be
        retrieved for all vertices) or a list. Elements in the list will be
        converted to boolean values C{True} or C{False}, and this will
        determine which part of the bipartite graph a given vertex belongs to.
      @raise ValueError: if the matching vector supplied does not describe
        a valid matching of the graph.
      """
      self._graph = graph
      self._matching = None
      self._num_matched = 0
      self._types = None
  
      if isinstance(types, str):
          types = graph.vs[types]
  
      self.types = types
      self.matching = matching
  
file_path: python-igraph/src/igraph/matching.py
imports: from igraph._igraph import Vertex
label_desc: Use image node_id 1 to create a new Matching object  with example: obj = Matching(graph, matching, types)