title: A perfect matching decomposition Graph in bipartite graph
body: <p>I'm looking for an algorithm that shows perfect matching decomposition Graph in the bipartite graph. I know the theory of this issue but I can't design this algorithm in Python.</p>
  
  <p>Def : A perfect matching decomposition is a decomposition such that each subgraph Hi in the decomposition is a perfect matching (A perfect matching M in graph G is a matching such that every vertex of G is incident with one of the edges of M )</p>
  
  <p>as I'm a beginner in python could you please guide me about the below code ( how can I test it that its a perfect matching decomposition graph or not? ) 
  vertices : 20 and degree should be between 4&amp;8</p>
  
  <pre><code>import networkx as nx
  from networkx import bipartite
  
  def plotGraph(graph):
  import matplotlib.pyplot as plt
  fig=plt.figure()
  ax=fig.add_subplot(111)
  
  pos=[(ii[1],ii[0]) for ii in graph.nodes()]
  pos_dict=dict(zip(graph.nodes(),pos))
  nx.draw(graph,pos=pos_dict,ax=ax,with_labels=True)
  plt.show(block=False)
  return
  
  def enumMaximumMatching(g):
  all_matches=[]
  return all_matches
  
  if __name__=='__main__':
  g=nx.Graph()
  edges=[
      [(1,0), (0,0)],
      [(1,0), (0,8)],
      [(1,0), (0,7)],
      [(1,0), (0,5)],
      [(1,0), (0,6)],
      [(1,1), (0,7)],
      [(1,1), (0,0)],
      [(1,1), (0,9)],
      [(1,1), (0,4)],
      [(1,1), (0,8)],
      [(1,1), (0,6)],
      [(1,2), (0,2)],
      [(1,2), (0,3)],
      [(1,2), (0,8)],
      [(1,2), (0,0)],
      [(1,3), (0,9)],
      [(1,3), (0,7)],
      [(1,3), (0,6)],
      [(1,3), (0,5)],
      [(1,3), (0,4)],
      [(1,3), (0,3)],
      [(1,4), (0,3)],
      [(1,4), (0,0)],
      [(1,4), (0,2)],
      [(1,4), (0,8)],
      [(1,5), (0,2)],
      [(1,5), (0,6)],
      [(1,5), (0,7)],
      [(1,5), (0,8)],
      [(1,5), (0,0)],
      [(1,6), (0,1)],
      [(1,6), (0,7)],
      [(1,6), (0,5)],
      [(1,6), (0,6)],
      [(1,7), (0,4)],
      [(1,7), (0,3)],
      [(1,7), (0,2)],
      [(1,7), (0,1)],
      [(1,8), (0,8)],
      [(1,8), (0,9)],
      [(1,8), (0,7)],
      [(1,8), (0,6)],
      [(1,9), (0,4)],
      [(1,9), (0,3)],
      [(1,9), (0,2)],
      [(1,9), (0,1)],
      [(1,9), (0,5)],
      [(1,6), (0,2)],
      [(1,6), (0,9)],
  
  ]
  
  for ii in edges:
      g.add_node(ii[0],bipartite=0)
      g.add_node(ii[1],bipartite=1)
  
  g.add_edges_from(edges)
  plotGraph(g)
  
  all_matches=enumMaximumMatching(g)
  
  for mm in all_matches:
      g_match=nx.Graph()
      for ii in mm:
          g_match.add_edge(ii[0],ii[1])
      plotGraph(g_match)
  </code></pre>
  
  <p>Thank you</p>