A method to simulate molecular reactions with a graph whose nodes represent molecules or atomic modules and whose edges represent the bond/contact relation is proposed. The graph is updated by two actions: passive rewiring of contact edges that gives the graph a small-world property and active rewiring by active nodes' programs that rewire bond and contact edges. As examples, the replication of a chain molecule and the partitioning of a network are successfully simulated.