ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 13 May 2011 12:01:03 +0200Graph minors in programminghttps://ask.sagemath.org/question/8111/graph-minors-in-programming/Hello
In a program I am writing, I need to know whether or not one graph is a minor of another, True or False. The function g.minor(h) returns the parts of g that are the minor h, if it exists, something like this:
{0: [2], 1: [1], 2: [0], 3: [3, 6], 4: [4], 5: [5]}
UPDATE: I think I can handle this but I'm sure it's not the best way, so any help is still appreciated. By doing L = g.minor(h) and then testing if len(flatten(L.values())) > 0, I will get True if h is a minor of g (or so it seems).
If no such minor exists, it throws an error. To be specific, it says "Traceback", then several lines of stuff I don't get at all, and then "ValueError: This graph has no minor isomorphic to H !". I don't know how to deal with either of these situations really. Can you help me out? Again, I just want True in the first case and False in the second case for programming purposes, as in graph theory knowing if a graph has another graph as a minor is very important in many instances.
I am using Version 4.6 (since I am a Windows user), in case that matters.
Thanks for any help!G-SageFri, 13 May 2011 12:01:03 +0200https://ask.sagemath.org/question/8111/