Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Rough Tentative

sage: def remove_one(G):
....:     store = []
....:     newG = copy(G)
....:     for v in newG:
....:         neigh = set(newG.neighbors(v))
....:         if neigh in store:
....:             newG.delete_vertex(v)
....:             return newG
....:         store.append(neigh)
....:     return G
....:     
sage: G=graphs.CycleGraph(4)
sage: remove_one(G)
Cycle graph: Graph on 3 vertices
sage: remove_one(_)
Cycle graph: Graph on 2 vertices
sage: remove_one(_)
Cycle graph: Graph on 2 vertices
sage: remove_one(_)