- mentpy.GraphState.__getitem__(n)
Returns a dict of neighbors of node n. Use: ‘G[n]’.
- Parameters:¶
- n : node¶
A node in the graph.
- Returns:¶
adj_dict – The adjacency dictionary for nodes connected to n.
- Return type:¶
dictionary
Notes¶
G[n] is the same as G.adj[n] and similar to G.neighbors(n) (which is an iterator over G.adj[n])
Examples¶
>>> G = nx.path_graph(4) # or DiGraph, MultiGraph, MultiDiGraph, etc >>> G[0] AtlasView({1: {}})