NetworkX

Previous topic

networkx.MultiGraph.neighbors_iter

Next topic

networkx.MultiGraph.adjacency_list

Quick search

networkx.MultiGraph.__getitem__

MultiGraph.__getitem__(n)

Return the neighbors of node n. Use “G[n]”.

Notes

G[n] is similar to G.neighbors(n) but the internal data dictionary is returned instead of a list.

G[u][v] returns the edge data for edge (u,v).

>>> G=nx.path_graph(4)
>>> print G[0][1]
1

Assigning G[u][v] may corrupt the graph data structure.

Examples

>>> G=nx.path_graph(4)
>>> print G[0]
{1: 1}