We present a tool that aids in the modeling of optical circuits, both in the frequency and in the time domain. The tool is based on the definition of a node, which can have both an instantaneous input-output relation, as well as different state variables (e.g. temperature and carrier density) and differential equations for these states. Furthermore, each node has access to part of its input history, allowing the creation of delay lines or digital filters. Additionally, a node can contain sub-nodes, allowing the creation of hierarchical networks. This tool can be used in numerous applications such as frequency-domain analysis of optical ring filters, time-domain analysis of optical amplifiers, microdisks and microcavities. Although we mainly use this tool to model optical circuits, it can also be used to model other classes of dynamical systems, such as electrical circuits and neural networks.