#10939: Relabel a graph according to a function
---------------------------------+------------------------------------------
Reporter: nthiery | Owner: jason, ncohen, rlm
Type: enhancement | Status: new
Priority: major | Milestone: sage-4.7
Component: graph theory | Keywords:
Author: Nicolas M. ThiƩry | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
---------------------------------+------------------------------------------
Comment(by dsm):
This question is slightly orthogonal to the patch, but was the first thing
I thought to try. `:-)` Should we require an explicit parameter to
relabel a graph into loopiness/multiedgeness if it isn't already? It
seems far more likely to be an accident than to be intended, and currently
can get a graph into weird states:
{{{
sage: G = graphs.CubeGraph(3)
sage: G.relabel()
sage: G.vertices(), G.edges()
([0, 1, 2, 3, 4, 5, 6, 7], [(0, 1, None), (0, 2, None), (0, 4, None), (1,
3, None), (1, 5, None), (2, 3, None), (2, 6, None), (3, 7, None), (4, 5,
None), (4, 6, None), (5, 7, None), (6, 7, None)])
sage: G.relabel(lambda x: 0)
sage: G
3-Cube: Graph on 8 vertices
sage: G.vertices()
[0]
sage: G.edges()
[(0, 0, None), (0, 0, None), (0, 0, None)]
sage: G.allows_multiple_edges()
False
sage: G.multiple_edges()
[(0, 0, None), (0, 0, None), (0, 0, None)]
sage: G.allows_loops()
False
sage: G.loops()
[(0, 0, None), (0, 0, None), (0, 0, None)]
sage: G.loop_vertices()
[]
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10939#comment:1>
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.