Switch between materials within material
To use nodetree elements multiple time and have all update, when you change a single instance, use node groups.

Grouping nodes can simplify a node tree by allowing instancing and hiding parts of the tree. Both material and composite nodes can be grouped.
Conceptually, grouping nodes allows you to specify a set of nodes that you can treat as though it were “just one node”. Node groups are similar to functions in programming, they can be reused in many places in a node tree and can be customized by changing the “parameters” of the node group.

To make a group, select the nodes and press CtrlG.