Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple loops handling in c_graph #12135

Closed
sagetrac-brunellus mannequin opened this issue Dec 9, 2011 · 12 comments
Closed

Multiple loops handling in c_graph #12135

sagetrac-brunellus mannequin opened this issue Dec 9, 2011 · 12 comments

Comments

@sagetrac-brunellus
Copy link
Mannequin

sagetrac-brunellus mannequin commented Dec 9, 2011

Sage handles multiple loops on one vertex inconsistently.

sage:g=Graph({0:[0,0]}, loops=True, multiedges=True, implementation="c_graph")
sage:g.edges()
[(0, 0, None), (0, 0, None)]
sage:g.delete_edge(0,0)
sage:g.edges()
[]

Compare with

sage:g=Graph({0:[0,0]}, loops=True, multiedges=True, implementation="networkx")
sage:g.edges()
[(0, 0, None), (0, 0, None)]
sage:g.delete_edge(0,0)
sage:g.edges()
[(0, 0, None)]

and

sage:g=Graph({0:[1,1]}, loops=True, multiedges=True, implementation="c_graph")
sage:g.edges()
[(0, 1, None), (0, 1, None)]
sage:g.delete_edge(0,1)
sage:g.edges()
[(0, 1, None)]

Apply:

Component: graph theory

Keywords: Cernay2012

Author: Lukáš Lánský

Reviewer: Nathann Cohen

Merged: sage-5.0.beta4

Issue created by migration from https://trac.sagemath.org/ticket/12135

@sagetrac-brunellus sagetrac-brunellus mannequin added this to the sage-5.0 milestone Dec 9, 2011
@sagetrac-brunellus
Copy link
Mannequin Author

sagetrac-brunellus mannequin commented Feb 6, 2012

comment:1

A loop is stored as a single arc, but del_edge removes both ends:

self._cg.del_arc_label(u_int, v_int, l_int)
self._cg.del_arc_label(v_int, u_int, l_int)

So...

sage: g=Graph({0:[0]*11}); len(g.edges())
11
sage: g.delete_edge(0,0); len(g.edges())
9
sage: g.delete_edge(0,0); len(g.edges())
7
sage: g.delete_edge(0,0); len(g.edges())
5

@sagetrac-brunellus

This comment has been minimized.

@sagetrac-brunellus

This comment has been minimized.

@sagetrac-brunellus
Copy link
Mannequin Author

sagetrac-brunellus mannequin commented Feb 6, 2012

comment:2

OK, this was rather easy.

@nathanncohen
Copy link
Mannequin

nathanncohen mannequin commented Feb 6, 2012

comment:3

Attachment: trac_12135_loop_removal.patch.gz

Helloooooooo !!!

Here is a one-line patch to add the "::" at the end of the line before the tests. If if it ok with you, the patch can be set to "positive_review". :-)

Nathann

(and I changed the subject because I am at Cernay with the combinat team, and that is how they want to remember which patches we worked on... Sorry about that ^^;)

@nathanncohen nathanncohen mannequin changed the title Multiple loops handling in c_graph Multiple loops handling in c_graph -- Cernay2012 Feb 6, 2012
@sagetrac-brunellus
Copy link
Mannequin Author

sagetrac-brunellus mannequin commented Feb 6, 2012

comment:5

Attachment: trac_12135_review.patch.gz

Sorry, I keep forgetting about that. :-/ Thanks for the review. :-)

@sagetrac-brunellus
Copy link
Mannequin Author

sagetrac-brunellus mannequin commented Feb 6, 2012

Reviewer: Nathann Cohen

@sagetrac-brunellus
Copy link
Mannequin Author

sagetrac-brunellus mannequin commented Feb 6, 2012

Author: Lukáš Lánský

@sagetrac-brunellus

This comment has been minimized.

@nathanncohen
Copy link
Mannequin

nathanncohen mannequin commented Feb 6, 2012

comment:7

Looks like it shouldn't be in the topic but in the keywords... ^^;

Thank you for the patches and the names :-)

Nathann

@nathanncohen
Copy link
Mannequin

nathanncohen mannequin commented Feb 6, 2012

Changed keywords from none to Cernay2012

@nathanncohen nathanncohen mannequin changed the title Multiple loops handling in c_graph -- Cernay2012 Multiple loops handling in c_graph Feb 6, 2012
@jdemeyer
Copy link

Merged: sage-5.0.beta4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants