#18289: Make graph display configurable
-------------------------------------+-------------------------------------
Reporter: vbraun | Owner:
Type: defect | Status: needs_review
Priority: major | Milestone: sage-6.7
Component: graph theory | Resolution:
Keywords: | Merged in:
Authors: Volker Braun | Reviewers: Nathann Cohen
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/vbraun/graph_preference | 6f1f1fe014e16abb644ba521347f0cbf085dff4a
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Comment (by ncohen):
Yo,
> I added pictorial representation to graphs because somebody went through
a lot of trouble to hack that as a special case into `show(graph)` (but
not for posets). I never wanted everything to be plotted that has a plot
method. I thought it would be appreciated if I replace said kludge with
always showing graphs as pictures. Ok, now I know you actually don't want
graphs shown as pictures, except in `show(graph)` to preserve the
inconsistency until we can deprecate it. Fine with me.
Wow. And it only took a week of posts. How constructive can we get?
> The attached branch now implements this.
And much more. Here is a first-pass review:
- Thanks for fixing the command-line usage
- With your modifications, the notebook displays a picture of the graph
when it
has order 0<..<20. Notebook users, who may be beginners, could get used
to
graphs that are displayed so easily, and not know what do to when, by
adding a
vertex to their graph, they can't obtain a plot anymore. When the graphs
is
*not* plotted because it is too large, it may be good to hint at how
they
could get a plot, a bit like what happens for matrices:
{{{
sage: identity_matrix(100)
100 x 100 dense matrix over Integer Ring (use the '.str()' method to see
the entries)
}}}
What would you think of returning a string similar to that in the
notebook
when the graph is too big to be automatically plotted?
{{{
Petersen graph: Graph on 10 vertices (use the '.show()' method to see
the graph)
}}}
- The one-line description, and the information we get from it, is not
provided
by the drawing only. What would you think, when in the notebook, to do
both at
once: print the string *AND* plot the graph? Users would get more than
what
they get in the command-line interface because their UI has more
capacities.
The useful information is especially the number of vertices and whether
the
graph allows loops/multiple edges.
I also thought of adding the number of edges there, eventually: this
information could be useful to both kind of users.
- Could you explain this part of the code?
{{{
output = self.plot(**kwds)._rich_repr_(display_manager)
if output is not None:
return output
}}}
In which case would this call return a "None"?
- About other graph-like objects
{{{
Whether to graphically display graphs, posets, and other
graph-like objects. When not specified small objects are show
graphically and large objects as textual overview.
}}}
Posets do not inherit from graphs. Neither do automata, crystals, and
many of
the things that you may want to be plotted. Thus, currently this piece
of
documentation is incorrect (for posets), but we may also want to add
others. Otherwise, graphs will just be an oddity in the notebook.
- Do you still plan to deprecate show in #18302?
- About the backend `default_preferences` functions that you add: right
now they
build an object (containing the preferences) that they return, but in
order to
change one specific preference one needs to overwrite the function with
a new
one. What would you think of having a `DisplayPreferences` object in
each of
those backends files? This way we would be able to change their settings
in a
`~/.sage/sage.init` file with just a line, i.e. something like:
{{{
sage.repl.rich_output.backend_ipython.display_preferences["figsize"]=10000
}}}
Nathann
--
Ticket URL: <http://trac.sagemath.org/ticket/18289#comment:86>
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.