In this paper, we propose a graph-transformational approach to swarm computation that is flexible enough to cover various existing notions of swarms and swarm computation, and it provides a mathematical basis for the analysis of swarms with respect to their correct behavior and efficiency. A graph transformational swarm consists of members of some kinds. They are modeled by graph transformation units providing rules and control conditions to specify the capability of members and kinds. The swarm members act on an environment—represented by a graph—by applying their rules in parallel. Moreover, a swarm has a cooperation condition to coordinate the simultaneous actions of the swarm members and two graph class expressions to specify the initial environments on one hand and to fix the goal on the other hand. Semantically, a swarm runs from an initial environment to one that fulfills the goal by a sequence of simultaneous actions of all its members. As main results, we show that cellular automata and particle swarms can be simulated by graph-transformational swarms. Moreover, we give an illustrative example of a simple ant colony the ants of which forage for food choosing their tracks randomly based on pheromone trails.