Ask Your Question

Sammy Black's profile - activity

2019-08-02 07:20:07 -0600 received badge  Popular Question (source)
2019-06-25 15:17:59 -0600 received badge  Nice Question (source)
2018-09-18 21:51:00 -0600 received badge  Famous Question (source)
2018-09-18 21:51:00 -0600 received badge  Notable Question (source)
2017-08-04 10:40:40 -0600 received badge  Notable Question (source)
2017-08-04 10:40:40 -0600 received badge  Popular Question (source)
2014-05-13 14:48:03 -0600 received badge  Good Question (source)
2013-08-05 07:44:09 -0600 received badge  Famous Question (source)
2013-05-12 12:42:56 -0600 marked best answer Why does graph minor not work with multiple edges?

I would say that if you split all edges of both graph by adding adding a new vertex b joined to a and c where there was an edge from a to c (this is a way to transform a graph with multiple edges into a normal graph), then checking that one is a minor of the other would give you the good definition.

I expect it to be slower, though.

And the explanation to your question "why aren't multiple edges considered by the minor function" is very easy and natural : why should it ? Things get implemented if somebody who cares about them takes the time to do it. Otherwise, they are not implemented.

Nathann

2013-05-12 12:42:50 -0600 commented answer Why does graph minor not work with multiple edges?

Yeah. I had already done that, but it was too slow. Thank you, though.

2013-05-11 14:30:09 -0600 asked a question Why does graph minor not work with multiple edges?

When $H$ has multiple edges, and we ask whether it is a minor of another graph $G$, using the method:

G.minor(H)

the multiple edges are ignored. As a result, it can return True, when $H$ is not actually a minor of $G$.

Here is a small example of this incorrect behavior.


Let $H$ be a triangle with a double edge, and let $G$ be a square. Clearly, $H$ is not a minor of $G$.

H = Graph()
H.allow_multiple_edges(True)
H.add_edges([(0,1), (0,1), (0,2), (1,2)])

G = Graph()
G.allow_multiple_edges(True)
G.add_edges([(0,1), (0,3), (1,2), (2,3)])

G.minor(H)

The output is:

{0: [0], 1: [1], 2: [2, 3]}

Is there a work-around?

2013-04-07 20:42:41 -0600 received badge  Popular Question (source)
2012-12-04 05:55:31 -0600 received badge  Nice Question (source)
2012-09-13 11:31:22 -0600 received badge  Notable Question (source)
2012-05-16 11:20:50 -0600 received badge  Nice Question (source)
2012-01-27 21:10:02 -0600 received badge  Popular Question (source)
2011-07-14 12:51:46 -0600 marked best answer How do I display the full output that includes graphics?

Try writing your output to an html file. Do something like:

f=open('myoutput.html','w')
f.write(some output)
f.write(some more output)
f.close()

That file should appear as a link in the output of the cell. If you click on the link, you should see your output as an html file.

2011-07-14 12:49:51 -0600 marked best answer Upgrade sage: build from sources?

I have never build sage from source. It is useful only if you plan on working on the development of sage or modify the source code. Your notebooks are not stored in sage directory but home. So you can just delete the present version, download sage 4.7 and install the binaries. That should work for most users.

2011-07-13 11:16:37 -0600 asked a question Upgrade sage: build from sources?

I'm using an older version of Sage (4.5.3) in Ubuntu 10.04. I like it, but I'd like to upgrade to a more recent version. From the command prompt, calling

$ sage -upgrade

throws a scary warning at me:

 ** WARNING: This is a source-based upgrade, which could take hours,
 ** fail, and render your Sage install useless!! This is a binary
 ** install, so upgrading in place is *not* recommended unless you are
 ** an expert.  Please consider installing a new binary from
 ** http://sagemath.org instead.

Question: Is there really a significant advantage to building the binaries from source?

I am running a Sony Vaio laptop on 4 2.13 GHz Intel cores. (I can specify more stats if it helps somebody to give me good advice.)

2011-03-30 14:36:28 -0600 commented question subsets with condition

You can create a set out of a list L with S = set(L). It will eliminate duplicates, and ignore the order. (You see the set elements sorted.) The set S has methods that impliment various set-theoretic operations. Type S.<tab> to see possibilities, such as S.intersect(T) which returns a the intersection of sets S and T.

2011-03-30 13:59:24 -0600 asked a question How do I display the full output that includes graphics?

Background

I am working in the notebook GUI.

I have code that produces graphics (.png files) to display arrays with colors satisfying certain combinatorial criteria. When the output gets too long, Sage returns the message

WARNING: Output truncated!
full_output.txt

The .txt file contains some html code, but doesn't display in a web browser.

Question

How do I see my graphical arrays?

2011-03-21 14:27:54 -0600 received badge  Nice Question (source)
2011-03-21 10:59:31 -0600 commented answer Why does graph plotting crop so aggressively, and what is a work-around?

Thanks. I wasn't using the keyword `axes_pad` explicitly, but rather trying to hack the `graph_plot.py` module. This works.

2011-03-21 10:57:57 -0600 marked best answer Why does graph plotting crop so aggressively, and what is a work-around?

Try this:

sage: g1 = Graph({0:{1:'a'}, 1:{2:'b'}, 2:{0:'c'}})
sage: g2 = Graph({0:{1:'a'}, 1:{2:'b'}, 2:{3:'c'}, 3:{0:'d'}})
sage: G = graphics_array([g1.plot(), g2.plot()])
sage: G.show(axes_pad=0.1)
2011-03-21 10:57:42 -0600 commented question Why does graph plotting crop so aggressively, and what is a work-around?

@benjaminfjones: I am using 4.5.3. Perhaps it's time for an upgrade. :)

2011-03-21 08:00:06 -0600 asked a question Why does graph plotting crop so aggressively, and what is a work-around?

Surely, the Sage community is aware of this bug. For example, there is this ticket, in which the problem is supposed to be fixed. But it's not!

A patch is described: in sage/graphs/graph_plot.py we can add the line(?)

G._extra_kwds['axes_pad']=.05

Am I to change this value in order to fix this over-zealous cropping behavior? No matter what I do, in this regard, I still end up with graph vertices partially cut off.

What's the easy work-around? I would like to be able to plot graphics_array objects with several graphs (with their vertices clearly shown!).

(http://trac.sagemath.org/sage_trac/ti...)

2011-03-20 21:32:25 -0600 commented answer How do instantiate a new class properly?

Thanks, Felix. I should have mentioned that I was still having problems even when I renamed it `feynman.py`. I was just trying to mimic the style built into the various Sage (python) modules.

2011-03-20 21:30:20 -0600 marked best answer How do instantiate a new class properly?

Instead of "from feynman import *", try "attach feynman.sage" - my guess is that if you use the from ... import syntax then the .sage file is treated like a .py file rather than sage code.

2011-03-20 21:30:20 -0600 received badge  Scholar (source)
2011-03-20 21:30:19 -0600 received badge  Supporter (source)
2011-03-18 22:11:10 -0600 received badge  Student (source)
2011-03-18 21:23:26 -0600 asked a question How do instantiate a new class properly?

Background

I have created a new class FeynmanGraph that is a subclass of Graph. It has some extra methods, and the module in which it lives also has some extra functions. The most important method for my purposes searches for possible colorings of the vertices that satisfy certain combinatorial criteria that have to do with spanning trees. (The details are not important here.)

The code works. I should mention that I'm editing feynman.sage in a text editor and attaching it to a sage session in a terminal. Once a I create an instance of the class via

G = FeynmanGraph(...)

everything seems to work.

Now, I created a module in which I would like to define specific graphs, with specific labeling of the vertices and edges, as well as plot positioning information. Shouldn't I be able to import the module feynman and make definitions such as the following?

from feynman import *
def FatY(): # a particular graph
    G = FeynmanGraph(...)
    ...
    return G

When I do this, the methods for FeynmanGraph raise all kinds of errors of the type where they don't recognize various functions, such as max or partitions_set.

Question

How do I structure the modules and classes so that I can instantiate the class properly?