Query upward topological connections?

Apologies if this was answered before, but how can I query upward topological connectivity in OpenCascade (e.g. shells using a face, edges using a vertices).
I am able to use TopExp_Explorer successfully to query downward topological adjacencies but not upward ones

Kirill Gavrilov's picture

TopoDS_Shape lists only it's children, but not parent shapes. To figure out where shapes are used you still need to traverse in top-bottom direction. Tools like TopExp::MapShapesAndAncestors() might be helpful to collect this information for the given shape.