Ticket #7564 (closed enhancement: fixed)

Opened 3 years ago

Last modified 3 years ago

graph theory: degree sequence function

Reported by: mvngu Owned by: rlm
Priority: minor Milestone: sage-4.3
Component: graph theory Keywords:
Cc: Work issues:
Report Upstream: N/A Reviewers: Karl-Dieter Crisman, Nathann Cohen
Authors: Minh Van Nguyen Merged in: sage-4.3.alpha1
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

trac_7564-degree-sequences.patch Download (3.1 KB) - added by mvngu 3 years ago.
based on Sage 4.3.alpha0

Change History

comment:1 Changed 3 years ago by mvngu

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

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 3 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 3 years ago by 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 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 3 years ago by kcrisman

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

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

Changed 3 years ago by mvngu

based on Sage 4.3.alpha0

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

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:

  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 3 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 3 years ago by mhansen

  • Status changed from positive_review to closed
  • Reviewers set to Karl-Dieter Crisman, Nathann Cohen
  • Resolution set to fixed
  • Merged in set to sage-4.3.alpha1

comment:10 Changed 3 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.