Opened 13 years ago

Closed 12 years ago

Last modified 12 years ago

#3541 closed enhancement (fixed)

[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 Merged in:
Authors: Reviewers:
Report Upstream: Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

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 (5)

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

Download all attachments as: .zip

Change History (21)

comment:1 Changed 13 years ago by mhansen

Awesome!

comment:2 Changed 13 years ago by robertwb

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

comment:3 Changed 13 years ago by rlm

  • Owner changed from rlm to ekirkman

comment:4 Changed 13 years ago by mabshoff

  • Milestone set to sage-3.1.3

Changed 12 years ago by rlm

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

comment:5 Changed 12 years ago by rlm

This set of patches should fix #5248.

Changed 12 years ago by ekirkman

comment:6 Changed 12 years 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!)]

comment:7 Changed 12 years ago by rlm

Apply both patches in order.

comment:8 Changed 12 years ago by mabshoff

  • Milestone changed from sage-3.4.1 to sage-3.3

This is going into 3.3.

Cheers,

Michael

Changed 12 years ago by ekirkman

Just fixes edge_color and adds a doctest

comment:9 Changed 12 years 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.

comment:10 Changed 12 years 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

comment:11 Changed 12 years ago by mabshoff

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

Cheers,

Michael

comment:12 Changed 12 years 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

comment:13 Changed 12 years 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 12 years ago by mabshoff

comment:14 Changed 12 years ago by mabshoff

  • Resolution set to fixed
  • Status changed from new to closed

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

comment:15 Changed 12 years ago by rlm

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

Changed 12 years ago by mvngu

sample plot of a multi-edge graph

comment:16 Changed 12 years 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.