#15706: Graph built from their edges are simple by default
-------------------------+-------------------------------------------------
Reporter: | Owner:
ncohen | Status: needs_review
Type: | Milestone: sage-6.4
enhancement | Resolution:
Priority: major | Merged in:
Component: graph | Reviewers:
theory | Work issues:
Keywords: | Commit:
Authors: | f6087ffcf2370bdfe45a1162c7d7106c9829ad5c
Nathann Cohen | Stopgaps:
Report Upstream: N/A |
Branch: |
u/ncohen/15706 |
Dependencies: |
#15704 |
-------------------------+-------------------------------------------------
Comment (by ncohen):
> I see, I didn't realize that it was impossible to convert a simple graph
into a multigraph.
Nonononono, it is possible ! You can do `G.allow_multiple_edges(True)`,
but then you have to *know* that you need to do that.
> Is there at least an error thrown?
I don't understand what you are talking about, so I will answer the two
possibilities:
1) For .density() yes an error is thrown:
{{{
sage: Graph([(1,2),(1,2)]).density()
...
TypeError: Density is not well-defined for multigraphs.
}}}
2) For functions that use `scream_if_not_simple` too:
{{{
sage: Graph([(1,2),(1,2)]).is_split()
...
ValueError: This method is not known to work on graphs with multiedges.
Perhaps this method can be updated to handle them, but in the meantime if
you want to use it please disallow multiedges using
allow_multiple_edges().
}}}
3) No error is thrown when you want to add an edge to a (simple) graph
that already has it:
{{{
sage: g = Graph([(0,1)])
sage: g.edges()
[(0, 1, None)]
sage: g.add_edge(0,1)
sage: g.edges()
[(0, 1, None)]
}}}
I believe that this is what should happen, but of course it can be a
problem if you have created a simple graph by mistake, which can happen
with this automatic detection.
Nathann
--
Ticket URL: <http://trac.sagemath.org/ticket/15706#comment:25>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.