Hmmmm... If you want to enumerate all "partial permutations then you have 
much better to do. If you have a n x m matrix with n<m what you should do 
it take all subsets of n elements of n, and enumerate all permutations 
using those n columns among m. Even if I would LOVE to have a way to 
enumerate all matchings of a bipartite graph. It remains that when your 
graph is the complete bipartite graph the problem is a bit easier :-P

Nathann

On Wednesday, March 20, 2013 9:05:54 PM UTC+1, Tom Boothby wrote:
>
> Note that that code only works for graphs whose vertices are labeled 
> [0...n]. 
>
> On Wed, Mar 20, 2013 at 1:03 PM, Tom Boothby 
> <tomas....@gmail.com<javascript:>> 
> wrote: 
> > I use the following to iterate over all matchings and perfect matchings. 
> > 
> > def matchings(G): 
> >     edges = G.edges(labels = False) 
> >     verts = [[v] for v in G] 
> >     m = len(edges) 
> >     for match in DLXCPP(edges+verts): 
> >         yield [edges[t] for t in match if t < m] 
> > 
> > def perfect_matchings(G): 
> >     edges = G.edges(labels = False) 
> >     for match in DLXCPP(edges): 
> >         yield [edges[t] for t in match] 
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to