Ask Your Question

fieldofnodes's profile - activity

2019-12-28 11:19:43 -0500 received badge  Notable Question (source)
2018-06-26 14:41:03 -0500 received badge  Popular Question (source)
2017-04-18 11:11:15 -0500 commented answer How do I implement plantri in sagemath

So I had this working, but had to change computers. Now I get this error:

TypeError: the optional plantri package is not installed

Then when I try sage -i plantri in

jonathan@Field-Phys-Math ~/SageMath $ sage -i plantri
make: *** No rule to make target 'all-toolchain'.  Stop.

My version is SageMath version 7.5.1, Release Date: 2017-01-15

What is the deal?

2017-01-15 04:24:05 -0500 commented answer How do I add an attribute to the object/class "Graph?"

So here is my code:

import sage.graphs.generic_graph

class NewGraph(Graph): def is_apex(self): not_apex = False for v in self.vertex_iterator(): l = self.neighbors(v) g.delete_vertex(v) if self.is_planar(): return True self.add_vertex(v) self.add_edges([(v, y) for y in l]) return False

This is the result:

k6=graphs.CompleteGraph(6)

sage: k6.is_apex()

AttributeError Traceback (most recent call last) <ipython-input-3-e18df0843618> in <module>() ----> 1 k6.is_apex()

AttributeError: 'Graph' object has no attribute 'is_apex'

What is happening?

2017-01-11 15:15:44 -0500 commented answer How do I add an attribute to the object/class "Graph?"

I am unfamiliar with the details of the "Graph" class need to know where to go to look for more info. Help?

2017-01-11 15:14:09 -0500 asked a question using patches in sagemath

I would like to use patches in my sagemath scripts, along with certain library imports - as one does in python - but I am finding it hard to learn how to do this.

Can anyone assist in this regards?

2016-12-01 13:44:21 -0500 commented answer Does there exist a GUI web-app that allows for edge contractions and vertex splits?

Thank you, I am using that right now, it is definitely helpful.

2016-12-01 13:43:54 -0500 commented answer Does there exist a GUI web-app that allows for edge contractions and vertex splits?

I am very new to Sage, how would I use this in, say the terminal?

2016-11-30 11:29:51 -0500 asked a question Does there exist a GUI web-app that allows for edge contractions and vertex splits?

I am interested in creating a web-app that allows for graph creation, edge contraction, vertex splits, and then exports to sage.

If anyone knows of something like this already developed please let me know, otherwise any suggestions on how to begin?

Thanks

2016-11-05 14:22:56 -0500 received badge  Nice Answer (source)
2016-11-05 05:23:43 -0500 received badge  Necromancer (source)
2016-11-05 05:23:43 -0500 received badge  Teacher (source)
2016-11-04 16:57:23 -0500 answered a question hamiltonian paths?

Hi,

Sage has the command:

hamiltonian_cycle(algorithm='tsp')

"Returns a Hamiltonian cycle/circuit of the current graph/digraph A graph (resp. digraph) is said to be Hamiltonian if it contains as a subgraph a cycle (resp. a circuit) going through all the >vertices. Computing a Hamiltonian cycle/circuit being NP-Complete, this algorithm could run for some time depending on the instance.

ALGORITHM:

See Graph.traveling_salesman_problem for ‘tsp’ algorithm and find_hamiltonian from sage.graphs.generic_graph_pyx for >>‘backtrack’ algorithm.

INPUT:

algorithm - one of ‘tsp’ or ‘backtrack’. OUTPUT: If using the ‘tsp’ algorithm, returns a Hamiltonian cycle/circuit if it exists; otherwise, raises a EmptySetError exception. If >>using the ‘backtrack’ algorithm, returns a pair (B,P). If B is True then P is a Hamiltonian cycle and if B is False, P is a >>longest path found by the algorithm. Observe that if B is False, the graph may still be Hamiltonian. The ‘backtrack’ >>algorithm is only implemented for undirected graphs."

The above is directly from Hamiltonian Cycle

Added in the same area on the page is:

sage: g = graphs.HeawoodGraph()
sage: g.hamiltonian_cycle()
TSP from Heawood graph: Graph on 14 vertices
sage: g = graphs.PetersenGraph()
sage: g.hamiltonian_cycle()
Traceback (most recent call last):
...
EmptySetError: The given graph is not Hamiltonian

So clearly there is some algorithms on your question, though it is also known that this is an NP-Complete problem.

Good luck, fieldofnodes

2016-11-04 16:31:21 -0500 asked a question How do I add an attribute to the object/class "Graph?"

Hi,

I am researching methods that relate to graph minors. Currently I am looking at creating a method/function/attribute (I give the options as I do not know the best means, . . . , yet) which will allow me to test for forbidden minors.

An example is the complete graph on 6 vertices is a forbidden minor for the class of graphs that are not apex. Meaning, that given a graph G and a $v\in V(G)$, that $G-v$ is not planar. So the code that I have been working on should test if a graph matches a certain criteria. I would be able to ask SageMath in the following way

K6=graphs.CompleteGraph(6); K6.is_apex()

Of which the response would be

False

This is the code that I have been working on

def is_apex(g):
for v in g.vertex_iterator():
    l = g.neighbors(v)
    g.delete_vertex(v)
    if g.is_planar():
        return True
    g.add_vertex(v)
    g.add_edges([(v, y) for y in l])
return False

Now I had help on this from another member in the AskSage community, so thank you.

But now I am trying to do something like this:

class Graph():
not_apex = False
def is_apex(self):
    for v in self.vertex_iterator():
        l = self.neighbors(v)
        g.delete_vertex(v)
        if self.is_planar():
            return True
        self.add_vertex(v)
        self.add_edges([(v, y) for y in l])
    return False

Which when I enter

x.is_apex()

Of which the response that I get

---------------------------------------------------------------------------

AttributeError Traceback (most recent call last) <ipython-input-15-e74e0334c694> in <module>() ----> 1 x.is_apex()

AttributeError: 'Graph' object has no attribute 'is_apex'

I am still a nooooooooob, so any help in understanding what I need to do would be great.

Thank you

2016-10-11 19:50:11 -0500 commented answer How do I write function to test if a graph is apex?

Great mate. This is very much in the direction that I am heading. I really appreciate the comment.

2016-10-11 19:49:39 -0500 received badge  Supporter (source)
2016-10-10 15:18:52 -0500 asked a question How do I write function to test if a graph is apex?

I am working on topological graph theory problems and using SageMath. I want to create a function that give a boolean True or False answer, so I can use this answer for further use. My current function that I use:

def is_apex(a):
for v in a.vertex_iterator():
    l=a.neighbors(v)
    if a.is_planar(a.delete_vertex(v)):
        print("Deleting vertex ",v," makes a planar graph")
        a.add_vertex(v)
        a.add_edges([(v, y) for y in l])
    else:
        a.add_vertex(v)
        a.add_edges([(v, y) for y in l])
        print("Deleting vertex ",v," does not make a planar graph")

I am a noob when it comes to programming, and any help would be awesome.

I want a True returned if the graph is apex and a False value to return for not apex.

Thoughts?

2016-10-04 13:24:50 -0500 commented answer How do I implement plantri in sagemath

EXCELLENT!!! I did what you said, works great.

2016-10-04 13:24:21 -0500 received badge  Scholar (source)
2016-10-03 18:42:40 -0500 received badge  Nice Question (source)
2016-10-03 16:12:11 -0500 received badge  Student (source)
2016-10-03 15:33:32 -0500 asked a question How do I implement plantri in sagemath

I am using sagemath -7.3 and I have recently added the package "plantri-4.5" to my packages.

I want to generate all planar graphs that have connectivity (κ=3). I want to have an initial graph G0 with 4 vertices, which we know is the complete graph on 4 vertices (K_4).

Then, I want all planar graphs on 4 vertices that is 3−connected.

Then, I want all planar graphs on 5 vertices that is 3−connected.

Than, I want all planar graphs on 6 vertices that is 3−connected.

I would like to ensure that I am actually obtaining ALL graphs that have the above criteria.

My goal is to obtain up to n=15,all planar graphs of connectivity, κ=3. I mean of course vertex connectivity as well.

I have been looking at Plantri as a way to do this, as they claim to have this ability.

Though I am having issues actually using this program within the sage terminal (Linux: Ubuntu base with cinnamon 16.0).

Does anyone have any suggestions on how to use plantri in the sage environment?