#716 closed defect (fixed)
graph functions to_undirected and to_directed forget the loops and multiple edges
Reported by: | jason | Owned by: | was |
---|---|---|---|
Priority: | major | Milestone: | sage-2.8.8 |
Component: | combinatorics | Keywords: | graph, graphs |
Cc: | Merged in: | ||
Authors: | Reviewers: | ||
Report Upstream: | 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 12 years ago by
comment:2 Changed 12 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 12 years ago by
Changed 12 years ago by
Changed 12 years ago by
Changed 12 years ago by
Changed 12 years ago by
comment:3 Changed 12 years ago by
- Resolution set to worksforme
- Status changed from new to closed
comment:4 Changed 12 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 12 years ago by
- Milestone changed from sage-2.9 to 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 12 years ago by
- Resolution worksforme deleted
- Status changed from closed to reopened
comment:7 Changed 12 years ago by
- Milestone changed from sage-2.8.9 to sage-2.8.8
- Resolution set to fixed
- Status changed from reopened to closed
comment:8 Changed 12 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.