Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Determining Complete Multipartite Graphs (Specifically Tripartite)

I have been reading the Sage References, and it does not seem that complete multipartite graphs are defined in Sage yet. I have tried to critique the following two lines of code to see if it would work for complete multipartite graphs.

def is_complete_multipartite(p): return p.is_multipartite() and p.num_edges() == mul(map(len, p.multipartite_sets()))

dd = filter(is_complete_multipartite, d)

I get a "graph attribute needed" error. I just wanted to verify that this is the case. Thanks again for the help!

click to hide/show revision 2
No.2 Revision

Determining Complete Multipartite Graphs (Specifically Tripartite)

I have been reading the Sage References, and it does not seem that complete multipartite graphs are defined in Sage yet. I have tried to critique the following two lines of code to see if it would work for complete multipartite graphs.

def is_complete_multipartite(p):
    return p.is_multipartite() and p.num_edges() == mul(map(len, p.multipartite_sets()))

g.multipartite_sets()))

dd = filter(is_complete_multipartite, d)

d)

I get a "graph attribute needed" error. I just wanted to verify that this is the case. Thanks again for the help!