In this paper, the programming library nctx is proposed. It is a collection of algorithms tailored to the analysis of attributed networks that have context information associated to nodes or edges. Key feature of this library is the ability to guide network analysis tasks by means of user-defined functions. These functions receive the current state of an analysis task such that context information can be accessed easily. The user-defined function is able to guide further execution of the analysis task providing a novel way of considering context information during the analysis of complex structure.