I am working on hyper-cubes. I am currently using networX in python. I read that networkX is a very good library for working on graphs. My problem is that
1) I want to construct the all perfect matchings of hypercube Q4
and Q5
.
2) Then i want to verify that all perfect matchings always extends to Hamiltonian cycle of Hypercube?
P.S : its already proven all perfect matchings in hyper-cubes always extends to Hamiltonian Cycle in hyper-cubes.
I want to verify both these task by a computer program.
I am new to python. I write a code for constructing hyper-cube.
import networkx as nx
graphSize = 4
hypercube = nx.hypercube_graph(graphSize)
print("Nodes in Q_" + str(graphSize) + " : " + str(nx.Graph.number_of_nodes(hypercube)))
print("Edges in Q_" + str(graphSize) + " : " + str(nx.Graph.number_of_edges(hypercube)))
OUTPUT
Nodes in Q_4 : 16
Edges in Q_4 : 32
This runs perfectly fine. But i can't find any library or functions in networkX
to get the list of all perfect matchings. Can someone tell me if there is any function available in any python library for getting all perfect matching in graphs Or someone have the code who construct all the perfect matchings for only Q4
and Q5
. Thanks in Advance.