Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

'method' object is not subscriptable

Starting with a graph G, I would like to make a list, the ith element of which is the graph G with its ith edge deleted.

def graphlist(G):
    n=len(G.edges())
    L=[G.copy().delete_edge(G.edges[i][0], G.edges[i][1]) for i in range(n)]
    return L

When I enter the definition above, or a variation of it, I get the error

'method' object is not subscriptable

Thanks a lot for any suggestions!