adding vector valued attribute to an edge in networkx
<p>I want to add a list, say [1,2,3] to every edge in a directed networkX graph. Any ideas? I found something like this can be done for nodes (using np.array) but it did not work on edges.</p>

<p>You can add the attributes when you put the edges into the network.</p>

<pre><code>import networkx as nx
G=nx.Graph()
G.add_edge(1,2, values = [1,2,3])
G.add_edge(2,3, values = ['a', 'b', 'c'])
G.edge[1][2]['values']
&gt; [1, 2, 3]
G.edges(data = True)
&gt; [(1, 2, {'values': [1, 2, 3]}), (2, 3, {'values': ['a', 'b', 'c']})]
G.get_edge_data(1,2)
&gt; {'values': [1, 2, 3]}
</code></pre>

<p>or after the fact</p>

<pre><code>G.add_edge(4,5)
G.edge[4][5]['values'] = [3.14, 'parrot', 'shopkeeper']
G.edge[5][4]
&gt; {'values': [3.14, 'parrot', 'shopkeeper']}
</code></pre>

python graph networkx