def checkEdges(ringSet, lookup, oatoms):
    """atoms, lookup -> ring
    atoms must be in the order of traversal around a ring!
    break an optimal non N2 node and return the largest ring
    found
    """
    bondedAtoms = map( None, ringSet[:-1], ringSet[1:] )
    bondedAtoms += [ (ringSet[-1], ringSet[0]) ]

    # form a lookup for the ringSet list
    atomSet = {}
    for atomID in ringSet:
	atomSet[atomID] = 1
    results = []
    
    # for each bond in the ring, break it and find the smallest
    # rings starting on either side of the bond
    # keep the largest but rememeber to add the bond back at the
    # end
    for atom1, atom2 in bondedAtoms:
        # break a single edge in the ring
        handle1 = atom1.handle
        handle2 = atom2.handle
        oatoms1 = oatoms[handle1]
        oatoms2 = oatoms[handle2]
        index1 = oatoms1.index(atom2)
        index2 = oatoms2.index(atom1)

        # break the bond
        del oatoms1[index1]
	del oatoms2[index2]

	ring1 = getRing(atom1, atomSet, lookup, oatoms)
	ring2 = getRing(atom2, atomSet, lookup, oatoms)
	
	# keep the larger of the two rings
	if len(ring1) > len(ring2):
	    results.append((len(ring1),
                            handle1, handle2,
                            ring1))
	else:
    	    results.append((len(ring2),
                            handle2, handle1,
                            ring2))

        # retie the bond
        oatoms1.insert(index1, atom2)
        oatoms2.insert(index2, atom1)


    if not results:
	return None

    #  find the smallest ring
    size, incidentHandle, adjacentHandle, smallestRing = min(results)
    # dereference the handles
    incident, adjacent = lookup[incidentHandle], lookup[adjacentHandle]

    # break the bond between the incident and adjacent atoms
    oatomsI = oatoms[incidentHandle]
    oatomsA = oatoms[adjacentHandle]
    assert incident in oatomsA
    assert adjacent in oatomsI
    
    oatomsI.remove(adjacent)
    oatomsA.remove(incident)
atoms, lookup -> ring
    atoms must be in the order of traversal around a ring!
    break an optimal non N2 node and return the largest ring
    found