Ticket #3541 (closed enhancement: fixed)

Opened 2 years ago

Last modified 19 months ago

[with patch, positive review] graph multiedge plotting

Reported by: ekirkman Owned by: ekirkman
Priority: major Milestone: sage-3.3
Component: graph theory Keywords:
Cc: rlm, mabshoff Author(s):
Report Upstream: Reviewer(s):
Merged in: Work issues:

Description

Wanted: New code to make a pretty plot of graphs with multiedges. I'm working on a patch now and will post it soon.

Attachments

trac_3541-multiedge-1.patch Download (64.7 KB) - added by rlm 19 months ago.
This depends on #4774, and implements multiple edges for graphs only.
trac_3541_beezy.patch Download (52.1 KB) - added by ekirkman 19 months ago.
trac_3541_tinyfixes.patch Download (1.0 KB) - added by ekirkman 19 months ago.
Just fixes edge_color and adds a doctest
trac_3541-reviewer-doctest.patch Download (0.8 KB) - added by mabshoff 19 months ago.
trac_3541-multiedge-graph-example-plot.png Download (17.3 KB) - added by mvngu 19 months ago.
sample plot of a multi-edge graph

Change History

Changed 2 years ago by mhansen

Awesome!

Changed 2 years ago by robertwb

Some code from Ashley Saunders up at  http://wiki.wstein.org/2008/480a/theprojects

Changed 2 years ago by rlm

  • owner changed from rlm to ekirkman

Changed 2 years ago by mabshoff

  • milestone set to sage-3.1.3

Changed 19 months ago by rlm

This depends on #4774, and implements multiple edges for graphs only.

Changed 19 months ago by rlm

This set of patches should fix #5248.

Changed 19 months ago by ekirkman

Changed 19 months ago by rlm

  • summary changed from graph multiedge plotting to [with patch, positive review] graph multiedge plotting

This is still a little quirky, due to issues with #4774, but it will be great to get this merged. The only problems left are on a different ticket.

+ exp[(10!)(10!)]

Changed 19 months ago by rlm

Apply both patches in order.

Changed 19 months ago by mabshoff

  • milestone changed from sage-3.4.1 to sage-3.3

This is going into 3.3.

Cheers,

Michael

Changed 19 months ago by ekirkman

Just fixes edge_color and adds a doctest

Changed 19 months ago by ekirkman

  • cc mabshoff added
  • summary changed from [with patch, positive review] graph multiedge plotting to [with patch, needs tiny review (2 lines) on third patch only] graph multiedge plotting

I caught some things while looking at the plots. It should be a pretty quick review-- hopefully I got it in fast enough.

Changed 19 months ago by rlm

  • summary changed from [with patch, needs tiny review (2 lines) on third patch only] graph multiedge plotting to [with patch, positive review] graph multiedge plotting

Changed 19 months ago by mabshoff

What is the credit situation here? I assume Emily as author, Robert for review?

Cheers,

Michael

Changed 19 months ago by mabshoff

There is one doctest failure:

mabshoff@sage:/scratch/mabshoff/sage-3.3.rc1$ ./sage -t -long devel/sage/sage/combinat/crystals/crystals.py
sage -t -long "devel/sage/sage/combinat/crystals/crystals.py"
**********************************************************************
File "/scratch/mabshoff/sage-3.3.rc1/devel/sage/sage/combinat/crystals/crystals.py", line 553:
    sage: C.plot()
Expected:
    Graphics object consisting of 11 graphics primitives
Got:
    Graphics object consisting of 17 graphics primitives
**********************************************************************

I assume this is becase previously the graph was incorrect.

Cheers,

Michael

Changed 19 months ago by mabshoff

After checking with Mike Hansen he gave me the thumbs up for the change, so I will post a tiny reviewer patch in a second. Note that trac_3541_tinyfixes.patch is a diff, but I committed in Emily's name :)

Cheers,

Michael

Changed 19 months ago by mabshoff

Changed 19 months ago by mabshoff

  • status changed from new to closed
  • resolution set to fixed

Merged

  • trac_3541-multiedge-1.patch
  • trac_3541_beezy.patch
  • trac_3541_tinyfixes.patch
  • trac_3541-reviewer-doctest.patch

in Sage 3.3.rc1. :)

Cheers,

Michael

Changed 19 months ago by rlm

Emily wrote all that by herself. I only reviewed and helped her with matplotlib.

Changed 19 months ago by mvngu

sample plot of a multi-edge graph

Changed 19 months ago by mvngu

Uploaded an image of a sample plot of a multi-edge graph. The graph was produced using the following code from the docstring of sage.graphs.graph.GenericGraph.plot:

sage: g = Graph({}, loops=True, multiedges=True)
sage: g.add_edges([(0,0,'a'),(0,0,'b'),(0,1,'c'),(0,1,'d'), 
...     (0,1,'e'),(0,1,'f'),(0,1,'f'),(2,1,'g'),(2,2,'h')]) 
sage: g.plot(edge_labels=True, color_by_label=True, edge_style='dashed')

I uploaded the image here, so it can be referred to in the release tour of 3.3.

Note: See TracTickets for help on using tickets.