#6041: [with spkg, needs work] update NetworkX to version 0.99
--------------------------+-------------------------------------------------
Reporter: mvngu | Owner: rlm
Type: enhancement | Status: new
Priority: major | Milestone: sage-4.0.1
Component: graph theory | Keywords:
--------------------------+-------------------------------------------------
Comment(by mvngu):
Replying to [comment:4 rlm]:
> Replying to [comment:3 mvngu]:
> > I managed to get all doctests in
{{{sage/graphs/base/graph_backends.py}}} to pass, but at the expense of
deleting the following methods from the class {{{NetworkXGraphBackend}}}.
Here I assume that {{{NetworkXGraphBackend}}} is an undirected graph
without multiple edges.
>
> Incorrect. NetworkXGraphBackend is simply a wrapper for a NetworkX
graph, which can be directed, or have multiple edges.
Agreed. Version 0.99 now has:
* {{{Graph}}} --- An undirected graph class without multiple (parallel)
edges.
* {{{DiGraph}}} --- A directed graph that allows self-loops, but not
multiple (parallel) edges.
* {{{MultiGraph}}} --- An undirected graph that allows multiple
(parallel) edges with arbitrary data on the edges.
* {{{MultiDiGraph}}} --- A directed graph that allows multiple (parallel)
edges with arbitrary data on the edges.
These have been lifted off from the NetworkX 0.99 documentation.
{{{MultiGraph}}} is the successor to {{{XGraph}}} where we allow
{{{XGraph}}} to have multiple edges. And {{{MultiDiGraph}}} is the
successor to {{{XDiGraph}}} with multiple edges. According to the API
change log at
[[BR]][[BR]]
http://networkx.lanl.gov/reference/api_changes.html
[[BR]][[BR]]
Previously {{{XGraph}}} handle undirected graphs with or without multiple
edges, and {{{XDiGraph}}} handle directed graphs with or without multiple
edges. Now there are four graph classes instead of two, for handling the
different types of graphs.
[[BR]][[BR]]
> > 1. {{{loops}}} -- This is irrelevant with the API changes in NetworkX
0.99, since the class {{{Graph}}} from NetworkX 0.99 allows for self-loops
without having to explicitly set it with a boolean.
> > 1. {{{multiple_edges}}} -- Again irrelevant since the class
{{{Graph}}} doesn't allow multiple edges. Graphs with multiple edges
should now be constructed via the class {{{MultiGraph}}} (not directed),
or {{{MultiDiGraph}}} which allows for directed arcs.
>
> This isn't irrelevant, as *Sage* graphs can have loops or multiedges
set. What needs to happen is for loops and multiedges to become properties
of the backend, and for the appropriate work to go on there. We still need
to support these options. You should be working on top of the `part-1`
patch at #6085, since it implements part of this in `graph.py` (and so
that we're less likely to be stepping on each other's toes).
Thanks you for the pointer.
[[BR]][[BR]]
> > Here's a diff of the changes to `sage/graphs/base/graph_backends.py`:
>
> Next time you could probably attach the diff to the ticket... :)
No, the diff isn't meant to be committed in the future. It's there for
discussion and to explore ways to maintain compatibility with the existing
API in {{{graph_backends.py}}}. But as you can see, the diff clearly
breaks compatibility :-)
[[BR]][[BR]]
> > It looks like anything under {{{sage/graphs/}}} that uses
{{{sage/graphs/base/graph_backends.py}}} should be changed accordingly.
>
> Don't forget all of the rest of Sage! I think you'll find it much easier
to adapt the backend to behave exactly as before. Then, all the other
doctests should pass - that's what they're there for!
OK, let me see what I can do.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/6041#comment:5>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---