networkx/networkx — pull request #926 by brycethomas (2013-08-11 03:48:25+00:00)
Title: Fixes #885

This is designed to fix both reading and writing of edge spells (and deprecated edge slices) on `.gexf` format graphs.

The existing `add_spells` and `add_slices` methods are sufficiently generic in implementation to support serialization/deserialization of spells/slices for both nodes and edges and as such remain _functionally_ unchanged. Parameter names for the `add_spells` and `add_slices` methods have been changed in several instances though, to reflect the handling of either nodes _or_ edges. For example, ` def add_spells(self,node_element,node_data):` becomes `def add_spells(self,node_or_edge_element,node_or_edge_data):`.

Calls to the relevant `add_spells`/`add_slices` methods have been added during both deserialization of a `.gexf` graph file's edges to networkx format (read) and during serialization of a networkx graph's edges to a `.gexf` file format (write).

Below is an example Gephi `.gexf` file __some_file.gexf__. I illustrate the difference in output between the current networkx implementation and the implementation with this fix applied, assuming that __some_file.gexf__ is read in with networkx and written straight out again:

__some_file.gexf__:
```

```

Reading `some_file.gexf` and immediately writing back out to some other file with _existing_ networkx implementation (missing edge spells):
```
?xml version="1.0" encoding="utf-8"?>

```

Reading `some_file.gexf` and immediately writing back out to some other file with _fixed_ networkx implementation (edge spells appear):
```

```

Finally as a side note, there are some bugs with other aspects of `.gexf` serialization/deserialization. For example, the serialized output graph `mode` attribute is `static`. i.e. it is not honouring the `dynamic` graph mode specified in the input file. This, and a few other issues are orthogonal to the fix under consideration though and I will create separate issues for them.