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

degree(::Graph{Directed}, ::Int) does not count in-neighbors #4440

Open
YueRen opened this issue Jan 10, 2025 · 5 comments
Open

degree(::Graph{Directed}, ::Int) does not count in-neighbors #4440

YueRen opened this issue Jan 10, 2025 · 5 comments
Assignees
Labels
BREAKING Not possible in any 1.x release topic: combinatorics triage

Comments

@YueRen
Copy link
Member

YueRen commented Jan 10, 2025

There is a bug in degree(::Graph, ::Int) function, which you can check by running

using Oscar
G = Graph{Directed}(3)
add_edge!(G,1,2)
add_edge!(G,2,3)
degree(G,2) # returns 1, not 2

I will prepare a pull-request shortly.

@YueRen YueRen added the bug Something isn't working label Jan 10, 2025
@YueRen YueRen self-assigned this Jan 10, 2025
@YueRen YueRen changed the title degree(::Graph{Directed}, ::Int) degree(::Graph{Directed}, ::Int) does not count in-neighbors Jan 10, 2025
@lgoettgens

This comment was marked as off-topic.

@benlorenz benlorenz added BREAKING Not possible in any 1.x release triage and removed bug Something isn't working labels Jan 10, 2025
@benlorenz
Copy link
Member

see #4441 for details, we can keep this ticket open after #4441 is merged and discuss this further during triage.

@fingolfin
Copy link
Member

We discussed, degree needs to stay in its current behavior (otherwise it'd be breaking) but we should add functions to get the in and out degree (in_degree and out_degree? For tab completion, degree_in might be nicer`???). And then the docstrings should point to each others.

@lgoettgens
Copy link
Member

lgoettgens commented Jan 15, 2025

We could also deprecate degree(G::Graph{Directed}) in favor of outdegree(G) to somehow notify users of this weird current behaviour

@JohnAAbbott
Copy link
Contributor

Not sure if it is a good idea, but... we could have both in_degree and degree_in so that TAB completion is helpful and so that we have a mnemonic name. In the discussion it was stated that currently directed graphs in OSCAR must be "simple" (i.e. no loops, and no multiple edges); it would be good if the design of the functions is flexible enough to permit possible future extensions to the sorts of graph OSCAR can handle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BREAKING Not possible in any 1.x release topic: combinatorics triage
Projects
None yet
Development

No branches or pull requests

5 participants