Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I found another way! Given a graph $G$, ask Sage to create its line graph and then from there find all of the independent sets in the line graph. The independent sets in the line graph are precisely the matchings in the original graph. Here is the code for finding the matchings in $K_{4,5}$:

from sage.graphs.independent_sets import IndependentSets
M=[x for x in IndependentSets(L_B45)]