#19381: Refactor Graph.__init__
-------------------------+-------------------------------------------------
Reporter: | Owner:
ncohen | Status: needs_review
Type: | Milestone: sage-6.9
defect | Resolution:
Priority: major | Merged in:
Component: graph | Reviewers:
theory | Work issues:
Keywords: | Commit:
Authors: | a74b0ff454c22237989edef3078ae55552ccf02e
Nathann Cohen | Stopgaps:
Report Upstream: N/A |
Branch: |
u/ncohen/19381 |
Dependencies: |
-------------------------+-------------------------------------------------
Comment (by ncohen):
> Would it be possible in this ticket to add support for constructing a
graph by `[V, E]` like this:
Certainly not in this ticket. It refactors code, and it is already (as you
can see) a lot to review. I guess it can be done in another ticket,
though, I don't thing that there is any problem. With 5-6 lines any
ambiguity with the other kind of inputs can be cleared ([V,f],
list_of_edges, ...)
> I know I can do it like this
> {{{
> sage: G = Graph({1:[2], 2:[], 3:[], 4:[]})
> sage: G.vertices()
> [1, 2, 3, 4]
> }}}
> but this is somewhat cumbersome (and doesn't work for graphs with
labeled (multiple) edges).
{{{
sage: Graph({1:{2:['l1','l2']}},multiedges=True).edges()
[(1, 2, 'l1'), (1, 2, 'l2')]
}}}
See also `Graph.to_dictionary` which generates this kind of output.
Nathann
--
Ticket URL: <http://trac.sagemath.org/ticket/19381#comment:3>
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.