The previously proposed generalized approach to algebraic specification of distributed systems is
developed based on the novel category-theoretic construction called graphalgebra. The graphalgebraic specification
is based upon a directed multigraph, the edges of which represent computational operations performed in the
nodes of the system and the vertices denote the data exchange ports between the components. Changing the
system architecture during the life cycle leads to changes in the graph shape, computation algorithms, and data
exchange contents. For a formal description of such changes, a graph transformation technique for graphalgebras is
proposed. A novel category-theoretic construction called flexible graphalgebra is introduced which appeared to be
closely related to the well-known monad of diagrams. A functor is presented that produces all categories of flexible
graphalgebras from their signatures. The theoretical results are illustrated by examples from the field of automatic
synthesis of neural network architecture by step-by-step transformations.