#7564 closed enhancement (fixed)
graph theory: degree sequence function
Reported by: | mvngu | Owned by: | rlm |
---|---|---|---|
Priority: | minor | Milestone: | sage-4.3 |
Component: | graph theory | Keywords: | |
Cc: | Merged in: | sage-4.3.alpha1 | |
Authors: | Minh Van Nguyen | Reviewers: | Karl-Dieter Crisman, Nathann Cohen |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
The degree sequence of a graph is a basic property that is studied in an introductory course on graph theory. There should be examples explaining how to compute the degree sequence of a given graph.
Attachments (1)
Change History (11)
comment:1 Changed 11 years ago by
- Status changed from new to needs_review
comment:2 follow-up: ↓ 3 Changed 11 years ago by
- Status changed from needs_review to needs_work
I will ask for more, if it isn't too much trouble. Could there be a small wrapper to (the better one) called degree_sequence as well? I realize this is very low priority. If the graph theory tour ever gets back up, this would be ideal to put in it as well.
comment:3 in reply to: ↑ 2 ; follow-up: ↓ 4 Changed 11 years ago by
Replying to kcrisman:
Could there be a small wrapper to (the better one) called degree_sequence as well?
As I mentioned in my email to sage-devel, I'm unable to find a function or method in the graph theory module that computes the degree sequence of a given graph. So there is no function or method for wrapping, unless you can point me to such a method/function. On the other hand, are you suggesting that there be a method in the class GenericGraph
called degree_sequence()
that does exactly as its name implies? If so, then that could be done.
If the graph theory tour ever gets back up, this would be ideal to put in it as well.
Nod.
comment:4 in reply to: ↑ 3 Changed 11 years ago by
Replying to mvngu:
Replying to kcrisman:
Could there be a small wrapper to (the better one) called degree_sequence as well?
As I mentioned in my email to sage-devel, I'm unable to find a function or method in the graph theory module that computes the degree sequence of a given graph. So there is no function or method for wrapping, unless you can point me to such a method/function. On the other hand, are you suggesting that there be a method in the class
GenericGraph
calleddegree_sequence()
that does exactly as its name implies? If so, then that could be done.
Yes, that is exactly what I meant - wrapping the examples you provide, as it were. I don't have time to do this, unfortunately, though it should be pretty easy.
comment:5 Changed 11 years ago by
- Status changed from needs_work to needs_review
- Summary changed from graph theory: examples on degree sequences to graph theory: degree sequence function
The (new) patch trac_7564-degree-sequences.patch
defines the method GenericGraph.degree_sequence()
for computing the degree sequence of a graph.
comment:6 follow-up: ↓ 7 Changed 11 years ago by
Could it be possible to define in the same patch functions outdegree_sequence and indegree_sequence for DiGraphs? ? :-)
comment:7 in reply to: ↑ 6 Changed 11 years ago by
Replying to ncohen:
Could it be possible to define in the same patch functions outdegree_sequence and indegree_sequence for DiGraphs? ? :-)
Y-E-S, yes! :-)
The patch trac_7564-degree-sequences.patch
implements the following degree sequences:
degree_sequence()
--- the degree sequence of a (di)graph. This is implemented in the classGenericGraph
.in_degree_sequence()
--- the indegree sequence of a digraph. This is implemented in the classDiGraph
.out_degree_sequence()
--- the outdegree sequence of a digraph, also implemented in the classDiGraph
.
I use the method names in_degree_sequence()
and out_degree_sequence()
to be consistent with how the graph theory module names the indegree and outdegree methods.
comment:8 Changed 11 years ago by
- Status changed from needs_review to positive_review
Excellent ! Approved :-)
Thank you for contributing to the Graph Section !! :-)
comment:9 Changed 11 years ago by
- Merged in set to sage-4.3.alpha1
- Resolution set to fixed
- Reviewers set to Karl-Dieter Crisman, Nathann Cohen
- Status changed from positive_review to closed
comment:10 Changed 11 years ago by
A patch written, reviewed and merged in 11 hours ? O_O
God O_O
The patch
trac_7564-degree-sequences.patch
adds two examples to the methodGenericGraph.degree()
, showcasing how to obtain the degree sequence of a graph using that method.