We face the problem of devising optimal unification operators for sharing and linearity analysis of logic programs by abstract interpretation. We propose a new (infinite) domain ShLinOmega which can be thought of as a general framework from which other domains can be easily derived by abstraction. The advantage is that ShLinOmega is endowed with very elegant and optimal abstract operators for unification and matching, based on a new concept of sharing graph which plays the same role of alternating paths for pair sharing analysis. We also provide an alternative, purely algebraic description of sharing graphs. Starting from the results for ShLinOmega, we derive optimal abstract operators for two well-known domains which combine sharing and linearity: ShLin by Andy King and the classic Sharing X Lin.