Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#6859 closed enhancement (fixed)

[with patch, positive review] Add more graph generators

Reported by: myurko Owned by: rlm
Priority: minor Milestone: sage-4.1.2
Component: graph theory Keywords:
Cc: Merged in: Sage 4.1.2.alpha4
Authors: Michael Yurko Reviewers: Jason Grout, Minh Van Nguyen
Report Upstream: Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

This patch add graph generators for the hyper star, (n,k)-star, n-star, and bubble sort graph.

Attachments (6)

trac_6859.patch (7.7 KB) - added by myurko 10 years ago.
trac_6859_definitions.patch (2.7 KB) - added by myurko 10 years ago.
Adds definitions of graphs to docstrings
trac-6859-optimize.patch (4.3 KB) - added by jason 10 years ago.
apply on top of previous patches
trac-6859-optimize-fix.patch (728 bytes) - added by myurko 10 years ago.
trac_6859-ascii-chars.patch (1.7 KB) - added by mvngu 10 years ago.
use ASCII characters for quotation marks and long dashes
trac_6859-formatting-issues.patch (4.2 KB) - added by mvngu 10 years ago.
proper formatting of lists

Download all attachments as: .zip

Change History (21)

Changed 10 years ago by myurko

comment:1 Changed 10 years ago by myurko

  • Summary changed from Add more graph generators to [with patch, needs review] Add more graph generators

comment:2 Changed 10 years ago by ncohen

Would it be possible to add to the docstrings the definition of what these graphs should be ?

Nathann

comment:3 Changed 10 years ago by myurko

Sure. I'll add definitions.

comment:4 Changed 10 years ago by ncohen

  • Summary changed from [with patch, needs review] Add more graph generators to [with patch, needs work] Add more graph generators

I do not know if you are aware of it ( I was not until very recently ) but the docstrings are used to generate a very complete documentation accessible through there :

http://www.sagemath.org/doc/reference/graphs.html

This also means that you can use LaTeX in your description if you deem it necessary, and that the formula will be automatically translated into beautiful equations on this page ;-)

Nathann

comment:5 Changed 10 years ago by myurko

Well, I knew that you can use Latex in docstrings, but I tried not to use it since it is hard to read when introspecting.

Changed 10 years ago by myurko

Adds definitions of graphs to docstrings

comment:6 Changed 10 years ago by myurko

  • Summary changed from [with patch, needs work] Add more graph generators to [with patch, needs review] Add more graph generators

comment:7 Changed 10 years ago by jason

Very nice.

I'm attaching a patch which optimizes some of the code to use more python things (like swapping), plus fixes a few typos. I think someone needs to review my patch.

Changed 10 years ago by jason

apply on top of previous patches

comment:8 Changed 10 years ago by myurko

I obviously can't review the patch, but the swapping certainly looks better. Coding too long in java has made forget some of the nice python idioms.

comment:9 Changed 10 years ago by jason

Okay, positive review for your patch.

You can review my changes (just make sure that you still get the same graphs). If you okay my changes, change this ticket to "positive review".

comment:10 Changed 10 years ago by myurko

All the graphs except the n,k star graph worked still. However, it was just a one line fix to keep the v[0] = tmp_bit line inside the for loop (otherwise all the vertices become looped). I've uploaded a one line patch to fix it.

Changed 10 years ago by myurko

comment:11 Changed 10 years ago by jason

  • Summary changed from [with patch, needs review] Add more graph generators to [with patch, positive review] Add more graph generators

ah, right. Okay, then, positive review.

comment:12 Changed 10 years ago by mvngu

The patch trac_6859-ascii-chars.patch uses only ASCII characters for quotation marks and long dashes. Without it, merging trac_6859.patch and building the reference manual would result in the following error:

reading sources... sage/graphs/graph_generators /scratch/mvngu/release/sage-4.1.2.alpha2/local/lib/python2.6/site-packages/Sphinx-0.5.1-py2.6.egg/sphinx/environment.py:543: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6
  raise SphinxError(err.message)
Sphinx error:

Changed 10 years ago by mvngu

use ASCII characters for quotation marks and long dashes

Changed 10 years ago by mvngu

proper formatting of lists

comment:13 Changed 10 years ago by mvngu

The patch trac_6859-formatting-issues.patch fixes formatting of lists. Without it, I get the following warnings when building the reference manual:

WARNING: /scratch/mvngu/release/sage-4.1.2.alpha2/local/lib/python2.6/site-packages/sage/graphs/graph_generators.py:docstring of sage.graphs.graph_generators.GraphGenerators.HyperStarGraph:22: (WARNING/2) Bullet list ends without a blank line; unexpected unindent.
WARNING: /scratch/mvngu/release/sage-4.1.2.alpha2/local/lib/python2.6/site-packages/sage/graphs/graph_generators.py:docstring of sage.graphs.graph_generators.GraphGenerators.NKStarGraph:25: (WARNING/2) Bullet list ends without a blank line; unexpected unindent.
WARNING: /scratch/mvngu/release/sage-4.1.2.alpha2/local/lib/python2.6/site-packages/sage/graphs/graph_generators.py:docstring of sage.graphs.graph_generators.GraphGenerators.NStarGraph:19: (WARNING/2) Bullet list ends without a blank line; unexpected unindent.

comment:14 Changed 10 years ago by mvngu

  • Authors set to Michael Yurko
  • Merged in set to Sage 4.1.2.alpha3
  • Resolution set to fixed
  • Reviewers set to Jason Grout, Minh Van Nguyen
  • Status changed from new to closed

Merged patches in this order:

  1. trac_6859.patch
  2. trac_6859-ascii-chars.patch
  3. trac_6859_definitions.patch
  4. trac-6859-optimize.patch
  5. trac-6859-optimize-fix.patch
  6. trac_6859-formatting-issues.patch

comment:15 Changed 10 years ago by mvngu

  • Merged in changed from Sage 4.1.2.alpha3 to Sage 4.1.2.alpha4

There is no 4.1.2.alpha3. Sage 4.1.2.alpha3 was William Stein's release for working on making the notebook a standalone package.

Note: See TracTickets for help on using tickets.