Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Are you familiar with Python? I think it's an important prerequisite before learning how to use Sage.

My previous comment almost gave the full answer. If there are some functions you don't know how to use, you can always use ? to access the documentation from a notebook, as well as some examples (e.g. type Subsets? in a cell). Here is a possible solution for some graph G

G = graphs.TutteGraph()
G.relabel()

for U in Subsets(G.vertices(), 2): # iterate over the subsets of vertices of size 2
    H = G.copy() # copy the graph
    H.delete_vertices(flatten([G.neighbors(u, True) for u in U])) # build the list of neighbors of all vertices in the subset and delete them from H
    if not H.is_connected(): # test for connectivity
        print(U)