networkx/networkx — pull request #984 by ninjin (2013-10-17 04:36:16+00:00)
Title: Graph Initialisation Support for Tuple Edge-lists

Currently `convert.py` explicitly checks the type of a potential edge list. This disallows you from using tuples (which is pretty well-supported in the Python syntax) and causes some rather unexpected crashes when you use tuples as opposed to list or iterators.

yuzucha> python
Python 2.7.4 (default, Sep 26 2013, 03:20:56)
[GCC 4.7.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from networkx import Graph
>>> Graph(data=((1, 0, ), ))
Traceback (most recent call last):
File "", line 1, in
File "networkx/classes/graph.py", line 214, in __init__
convert.to_networkx_graph(data,create_using=self)
File "networkx/convert.py", line 149, in to_networkx_graph
raise nx.NetworkXError("Input is not a valid edge list")
networkx.exception.NetworkXError: Input is not a valid edge list
>>> Graph(data=[(1, 0, ), ])

>>> Graph(data=iter(((1, 0, ), )))

The patch passes the test suite, but I have not added any additional tests for this specific feature.