On 05/06/2010 03:20 PM, Ryan Hinton wrote:
My guess is that people using default labels *do not care* what the
edges are labeled. I would vote for a single default edge label
(instead of the apparent two defaults now), preferably something easy
to detect like None. But I'm not familiar with the source of the
problem, so I don't know how easy this is to implement.
The source of the problem is that the networkx library, upon which many
things are built, changed their defaults from None to an empty
dictionary. The thinking there is that instead of a "label", each edge
carries attributes (i.e., the empty dictionary). From a quick glance,
it appears that the networkx code assumes the label is a dictionary, so
if we continue to use their functions, we should convert labels to
dictionaries or change our defaults.
If the label represents the "weight", then the check would change from
G[u][v] is not None
# can use G[u][v] for the weight
to something like
'weight' in G[u][v]
# can use G[u][v]['weight'] for the weight
The nice thing is that the new design (using dictionaries) allows for
different attributes to be easily assigned. For example:
G[u][v].update(color='blue',style='dashed')
might set up some attributes for drawing the particular edge.
Thanks,
Jason
--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org