

def get_edge_data(self, u, v, key=None, default=None):
    "Return the attribute dictionary associated with edge (u,v).\n\n        Parameters\n        ----------\n        u,v : nodes\n        default:  any Python object (default=None)\n            Value to return if the edge (u,v) is not found.\n        key : hashable identifier, optional (default=None)\n            Return data only for the edge with specified key.\n\n        Returns\n        -------\n        edge_dict : dictionary\n            The edge attribute dictionary.\n\n        Notes\n        -----\n        It is faster to use G[u][v][key].\n\n        >>> G = nx.MultiGraph() # or MultiDiGraph\n        >>> G.add_edge(0,1,key='a',weight=7)\n        >>> G[0][1]['a']  # key='a'\n        {'weight': 7}\n\n        Warning: Assigning G[u][v][key] corrupts the graph data structure.\n        But it is safe to assign attributes to that dictionary,\n\n        >>> G[0][1]['a']['weight'] = 10\n        >>> G[0][1]['a']['weight']\n        10\n        >>> G[1][0]['a']['weight']\n        10\n\n        Examples\n        --------\n        >>> G = nx.MultiGraph() # or MultiDiGraph\n        >>> G.add_path([0,1,2,3])\n        >>> G.get_edge_data(0,1)\n        {0: {}}\n        >>> e = (0,1)\n        >>> G.get_edge_data(*e) # tuple form\n        {0: {}}\n        >>> G.get_edge_data('a','b',default=0) # edge not in graph, return 0\n        0\n        "
    try:
        if (key is None):
            return self.adj[u][v]
        else:
            return self.adj[u][v][key]
    except KeyError:
        return default

dataset/ETHPy150Open networkx/networkx/networkx/classes/tests/timingclasses.py TimingMultiGraph.get_edge_data/original