#716 closed defect (fixed)
graph functions to_undirected and to_directed forget the loops and multiple edges
Reported by: | Jason Grout | Owned by: | William Stein |
---|---|---|---|
Priority: | major | Milestone: | sage-2.8.8 |
Component: | combinatorics | Keywords: | graph, graphs |
Cc: | Merged in: | ||
Authors: | Reviewers: | ||
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
With a directed graph g
- g.to_directed() forgets multiedges, remembers loops
- g.to_undirected() forgets multiedges and loops
With an undirected graph g
- g.to_directed() forgets multiedges and loops
- g.to_undirected() forgets multiedges, remembers loops
In each of these cases, both multiedges and loops should be remembered.
sage: g=DiGraph({0:[0,1,1,2],1:[0,1]},loops=True,multiedges=True) sage: g.to_directed().multiple_arcs() False sage: g.to_directed().loops() True sage: g.to_undirected().multiple_edges() False sage: g.to_undirected().loops() False sage: g=Graph({0:[0,1,1,2],1:[0,1]},loops=True,multiedges=True) sage: g.to_directed().multiple_arcs() False sage: g.to_directed().loops() False sage: g.to_undirected().multiple_edges() False sage: g.to_undirected().loops() True
Attachments (6)
Change History (14)
comment:1 Changed 15 years ago by
comment:2 Changed 15 years ago by
The real problem is that the init function tests for a superclass before a subclass. The attached patch fixes it (and also adds a to_simple function that _does_ forget multiple edges, loops, and directions on edges).
The attached patch may break some of the doctests in graph.py, though.
Changed 15 years ago by
Attachment: | init_and_to_simple.hg added |
---|
Changed 15 years ago by
Attachment: | deep_copy.hg added |
---|
Fixes doctest failures and other strangeness
Changed 15 years ago by
Attachment: | doc_changes.hg added |
---|
Changed 15 years ago by
Attachment: | arc_edges.hg added |
---|
Changed 15 years ago by
Attachment: | change_arc_to_edge.hg added |
---|
Changed 15 years ago by
Attachment: | combinat-arcs2edges.patch added |
---|
comment:3 Changed 15 years ago by
Resolution: | → worksforme |
---|---|
Status: | new → closed |
comment:4 Changed 15 years ago by
As a side note, the above patches which were applied also changed all "arc" functions to "edge" functions. This, of course, broke backward compatibility.
comment:5 Changed 15 years ago by
Milestone: | sage-2.9 → sage-2.8.9 |
---|
I am curious if all those patches really were applied. They are over a months old, so I would assume so, but I do not understand why this ticket wasn't closed then.
Michael
comment:6 Changed 15 years ago by
Resolution: | worksforme |
---|---|
Status: | closed → reopened |
comment:7 Changed 15 years ago by
Milestone: | sage-2.8.9 → sage-2.8.8 |
---|---|
Resolution: | → fixed |
Status: | reopened → closed |
comment:8 Changed 15 years ago by
From Robert:
Michael, Regarding ticket #716, these patches were incorporated a while ago, and I closed the ticket last month when that happened. It looks like the ticket has been closed, but in a future milestone, ever since...
Cheers,
Michael
Apparently the copy doesn't preserve multiple edges settings.