Opened 13 years ago

Closed 13 years ago

# graph theory: degree sequence function

Reported by: Owned by: mvngu rlm minor sage-4.3 graph theory sage-4.3.alpha1 Minh Van Nguyen Karl-Dieter Crisman, Nathann Cohen N/A

### 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.

### comment:1 Changed 13 years ago by mvngu

• Authors set to Minh Van Nguyen
• Status changed from new to needs_review

The patch `trac_7564-degree-sequences.patch` adds two examples to the method `GenericGraph.degree()`, showcasing how to obtain the degree sequence of a graph using that method.

### comment:2 follow-up: ↓ 3 Changed 13 years ago by kcrisman

• 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 13 years ago by mvngu

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 13 years ago by 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.

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 13 years ago by mvngu

• 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 13 years ago by ncohen

Could it be possible to define in the same patch functions outdegree_sequence and indegree_sequence for DiGraphs? ? :-)

### Changed 13 years ago by mvngu

based on Sage 4.3.alpha0

### comment:7 in reply to: ↑ 6 Changed 13 years ago by mvngu

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:

1. `degree_sequence()` --- the degree sequence of a (di)graph. This is implemented in the class `GenericGraph`.
2. `in_degree_sequence()` --- the indegree sequence of a digraph. This is implemented in the class `DiGraph`.
3. `out_degree_sequence()` --- the outdegree sequence of a digraph, also implemented in the class `DiGraph`.

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 13 years ago by ncohen

• Status changed from needs_review to positive_review

Excellent ! Approved :-)

Thank you for contributing to the Graph Section !! :-)

### comment:9 Changed 13 years ago by mhansen

• 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 13 years ago by ncohen

A patch written, reviewed and merged in 11 hours ? O_O

God O_O

Note: See TracTickets for help on using tickets.