#7304: Contract edge in graph
--------------------------+-------------------------------------------------
Reporter: AJonsson | Owner: rlm
Type: enhancement | Status: needs_work
Priority: major | Milestone: sage-4.7
Component: graph theory | Resolution:
Keywords: | Author:
Upstream: N/A | Reviewer:
Merged: | Work_issues:
--------------------------+-------------------------------------------------
Comment(by ncohen):
> Anyway, my main point is that I feel there should be methods for
deletion and contraction that return a new graph, rather than modifying
the graph itself.
Would you be interested in mixing the two ? Like sometimes calling a
delete_edge function which returns a graph, and some other times a method
which modifies the graph ?
The current behaviour is necessary for many functions, and replacing it
would mean a huge loss in efficiency. It is possible to add a keyword to
all those methods so that a graph will be returned instead of modifying
the current graph. I don't quite like this, as it would mean some
additional tests for each of all those very fundamental functions, but
then again...
On the other hand, if you are not interested in mixing the two type of
operations, perhaps the best is to work on an immutable graph class. Many
people have asked this already, and when working on an immutable graph
class having a default behaviour of "returning an immutable copy of the
graph modified as requested" does not seem too unnatural. What about this
then ? `:-)`
Nathann
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/7304#comment:19>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.