#16449: Add plot() and show() methods to abstract Matroid class
-------------------------------------+-------------------------------------
Reporter: Jayant | Owner:
Type: enhancement | Status: needs_work
Priority: minor | Milestone: sage-6.3
Component: matroid theory | Resolution:
Keywords: visualization, | Merged in:
geometric representation | Reviewers:
Authors: | Work issues:
Report Upstream: N/A | Commit:
Branch: | f406d2e45dde540c5e75837660a18d9bdf076944
u/Jayant/ticket/16449 | Stopgaps:
Dependencies: |
-------------------------------------+-------------------------------------
Changes (by Stefan):
* status: needs_review => needs_work
Comment:
There are still issues with parallel elements and low-rank matroids.
This is a good example:
{{{
M = matroids.PG(3,2).contract(0)
M.show()
M.simplify().show()
}}}
Also, with the same example, specifying a basis goes wrong:
{{{
M.show(B=[5,6,7])
}}}
gives
{{{
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "_sage_input_24.py", line 10, in <module>
exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8
-*-\\n" +
_support_.preparse_worksheet_cell(base64.b64decode("TS5zaG93KEI9WzUsNiw3XSk="),globals())+"\\n");
execfile(os.path.abspath("___code___.py"))
File "", line 1, in <module>
File
"/private/var/folders/8p/gpt0bd4x5vg46bg2j4l0mnfr0000gn/T/tmpBK25kT/___code___.py",
line 3, in <module>
exec compile(u'M.show(B=[_sage_const_5 ,_sage_const_6 ,_sage_const_7
])
File "", line 1, in <module>
File "matroid.pyx", line 4958, in sage.matroids.matroid.Matroid.show
(build/cythonized/sage/matroids/matroid.c:33380)
File "matroid.pyx", line 4999, in sage.matroids.matroid.Matroid.show
(build/cythonized/sage/matroids/matroid.c:33147)
File "matroid.pyx", line 4956, in sage.matroids.matroid.Matroid.plot
(build/cythonized/sage/matroids/matroid.c:32728)
File "/Users/stefan/sage/local/lib/python2.7/site-
packages/sage/matroids/matroids_plot_helpers.py", line 763, in geomrep
[M, L, P] = slp(M1, pos_dict=pd, B=B1)
File "/Users/stefan/sage/local/lib/python2.7/site-
packages/sage/matroids/matroids_plot_helpers.py", line 445, in slp
newP.extend(list(pcl - set([pcl[0]])))
TypeError: 'frozenset' object does not support indexing
}}}
Then there's
{{{
M = matroids.Uniform(0,4)
M.show()
}}}
giving
{{{
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "_sage_input_25.py", line 10, in <module>
exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8
-*-\\n" +
_support_.preparse_worksheet_cell(base64.b64decode("TSA9IG1hdHJvaWRzLlVuaWZvcm0oMCw0KQpNLnNob3coKQ=="),globals())+"\\n");
execfile(os.path.abspath("___code___.py"))
File "", line 1, in <module>
File
"/private/var/folders/8p/gpt0bd4x5vg46bg2j4l0mnfr0000gn/T/tmp1peeRw/___code___.py",
line 4, in <module>
exec compile(u'M.show()
File "", line 1, in <module>
File "matroid.pyx", line 4958, in sage.matroids.matroid.Matroid.show
(build/cythonized/sage/matroids/matroid.c:33380)
File "matroid.pyx", line 4999, in sage.matroids.matroid.Matroid.show
(build/cythonized/sage/matroids/matroid.c:33147)
File "matroid.pyx", line 4956, in sage.matroids.matroid.Matroid.plot
(build/cythonized/sage/matroids/matroid.c:32728)
File "/Users/stefan/sage/local/lib/python2.7/site-
packages/sage/matroids/matroids_plot_helpers.py", line 830, in geomrep
list(set(L) | set(P)))
File "/Users/stefan/sage/local/lib/python2.7/site-
packages/sage/matroids/matroids_plot_helpers.py", line 157, in it
lines.append([B1[pairs[i-1][0]]])
IndexError: list index out of range
}}}
I'm not so sure about the output of
{{{
M3 = matroids.Uniform(1,6)
M3.show()
}}}
What does the set mean? Why is it so far removed from the point? Putting
*all* elements from the parallel class into the set is clearer. And leave
the point empty, or give it a new label (use the
sage.matroids.utilities.newlabel function) and write on the sidelines
n = {0,1,2,3,4,5}
(where n is the new label).
Finally, I'd go for a lighter gray for the points.
Please test thoroughly with lots of examples, especially degenerate ones,
before setting this to "needs_review" again.
--
Ticket URL: <http://trac.sagemath.org/ticket/16449#comment:29>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.