- property DiGraph.pred#
Graph adjacency object holding the predecessors of each node.
This object is a read-only dict-like structure with node keys and neighbor-dict values. The neighbor-dict is keyed by neighbor to the edge-data-dict. So
G.pred['color'] = 'blue'sets the color of the edge
Iterating over G.pred behaves like a dict. Useful idioms include
for nbr, datadict in G.pred[n].items():. A data-view not provided by dicts also exists:
for nbr, foovalue in G.pred[node].data('foo'):A default can be set via a
defaultargument to the