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

Add optional distance in BFS #16470

Closed
sagetrac-foosterhof mannequin opened this issue Jun 11, 2014 · 15 comments
Closed

Add optional distance in BFS #16470

sagetrac-foosterhof mannequin opened this issue Jun 11, 2014 · 15 comments

Comments

@sagetrac-foosterhof
Copy link
Mannequin

sagetrac-foosterhof mannequin commented Jun 11, 2014

There is no way to get the edge distance with a custom neighbor function.

breadth_first_search() does not report distance, and shortest_paths() does not give the option to specify a neighbor function.

CC: @sagetrac-Rudi

Component: graph theory

Keywords: breadth first search distance

Author: Florian Oosterhof

Branch/Commit: 0087e5b

Reviewer: Frédéric Chapoton

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

@sagetrac-foosterhof sagetrac-foosterhof mannequin added this to the sage-6.3 milestone Jun 11, 2014
@nathanncohen
Copy link
Mannequin

nathanncohen mannequin commented Jun 11, 2014

comment:1

I do not understand your problem, but do you know g.distance(by_weight=True) ? A BFS with a distance on the edges is called "Dijkstra's algorithm", and it is implemented in Sage.

Nathann

@sagetrac-foosterhof
Copy link
Mannequin Author

sagetrac-foosterhof mannequin commented Jun 11, 2014

Branch: u/foosterhof/ticket/16470

@sagetrac-foosterhof
Copy link
Mannequin Author

sagetrac-foosterhof mannequin commented Jun 11, 2014

comment:3

I need BFS to report the distance as well, the minimum number of edges/arcs to be traversed for every vertex. The shortest_paths method implements this, but it does not have any option to specify a neighbor function, which is possible in the breadth_first_search method.

My commit is a small modification that does implement this.


New commits:

c0dd8ffAdded optional argument (default False) to report distance along with vertex

@sagetrac-foosterhof
Copy link
Mannequin Author

sagetrac-foosterhof mannequin commented Jun 11, 2014

Upstream: Reported upstream. No feedback yet.

@sagetrac-foosterhof
Copy link
Mannequin Author

sagetrac-foosterhof mannequin commented Jun 11, 2014

Commit: c0dd8ff

@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.3, sage-6.4 Aug 10, 2014
@fchapoton
Copy link
Contributor

Changed commit from c0dd8ff to 0087e5b

@fchapoton
Copy link
Contributor

Changed branch from u/foosterhof/ticket/16470 to public/16470

@fchapoton
Copy link
Contributor

comment:5

I have made a review commit. I still need to check that the doc builds, otherwise thinks look good to me.

Can you have a look at my changes, and see if you agree with them ? They are mostly typographical.


New commits:

94262d9Merge branch 'u/foosterhof/ticket/16470' of trac.sagemath.org:sage into 16470
0087e5btrac #16470 reviewer's patch

@fchapoton
Copy link
Contributor

Reviewer: Frédéric Chapoton

@fchapoton
Copy link
Contributor

comment:6

Please put your real name in the author field of the ticket.

@fchapoton
Copy link
Contributor

Changed upstream from Reported upstream. No feedback yet. to none

@fchapoton
Copy link
Contributor

comment:8

Looks good to me. You can set a positive review on my behalf if you agree with my small typographical changes. And please add your real name in the author field.

@sagetrac-Rudi
Copy link
Mannequin

sagetrac-Rudi mannequin commented Oct 24, 2014

comment:9

Thank you for reviewing.

The author of this patch was my student Florian Oosterhof, who worked on this code as a part of his bachelor thesis. I'm not sure if he is still active on the sage trac, so I added his name in the author field on his behalf.

@sagetrac-Rudi
Copy link
Mannequin

sagetrac-Rudi mannequin commented Oct 24, 2014

Author: Florian Oosterhof

@vbraun
Copy link
Member

vbraun commented Oct 25, 2014

Changed branch from public/16470 to 0087e5b

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