This is a python library for simulation of mobility and contact models.
The following mobility models that simulate node movements are available:
- Random Walk
- Random Waypoint
- Random Direction
- Truncated Levy Walk 
- Gauss-Markov 
- Reference Point Group Mobility model 
- Time-variant Community 
In addition to models that simulate node position in time, this library also provides some models that simulate node contacts:
- Dynamic G(n,p), a dynamic version of the Erdős–Rényi model 
- Dynamic G(n,m), another dynamic version of the Erdős–Rényi model 
- The edge-Markovian dynamic graph model 
- The continuous-time edge-Markovian dynamic graph model 
- The Model B, as described in 
setuptools - from Git repository
> git clone git://github.com/panisson/pymobility.git > cd pymobility > python setup.py install (run as admin/root)
NumPy and Matplotlib
In a python shell, you can instantiate the mobility models available in the pymobility.models.mobility package. For example, to create a Random Waypoint model instace, use the following commands:
>>> from pymobility.models.mobility import random_waypoint >>> rw = random_waypoint(200, dimensions=(100, 100), velocity=(0.1, 1.0), wt_max=1.0)
This will create a Random Waypoint instance with 200 nodes in a simulation area of 100x100 units, velocity chosen from a uniform distribution between 0.1 and 1.0 units/step and maximum waiting time of 1.0 steps. This object is a generator that yields the position of the nodes in each step. For example, to print a 2-dimensional array with the node positions produced in the first step, call
>>> positions = next(rw) >>> print positions
You can also iterate over the positions produced in each step:
>>> for positions in rw: ... print positions ...
The contact models are available in the pymobility.models.contact package. Differently from the mobility package that yield node positions for each time step, the contact models yield a list of node pairs that were in contact at each time step. For example, to create a Dynamic G(n,p) model instance, use the following commands:
>>> from pymobility.models.contact import dynamic_gnp >>> m = dynamic_gnp(200, p=0.01)
This will create a Dynamic G(n,p) model instance with 200 nodes that generates a list of contacts
at each time step.
The probability of any edge appearing at each step is defined by the parameter p.
Now you can iterate over the list of contacts produced in each time step:
>>> for contacts in m: ... for source, target in contacts: ... print (source, target)
Simulation and Visualization
The script pymobility/simulation.py, under the src directory, contains examples on how to run different models and to plot the points in a simulation area using Matplotlib. To run it, open a shell prompt, go to the src directory and run the following command:
If you have a Github account please fork the repository, create a topic branch, and commit your changes. Then submit a pull request from that branch.
Written by André Panisson email@example.com
Copyright (C) 2012 Istituto per l'Interscambio Scientifico I.S.I.
You can contact us by email (firstname.lastname@example.org) or write to:
ISI Foundation, Via Alassio 11/c, 10126 Torino, Italy.
The Model B was implemented with the contribution of Juliette Stehle.
 Injong Rhee, Minsu Shin, Seongik Hong, Kyunghan Lee, and Song Chong. On the Levy-Walk Nature of Human Mobility. In 2008 IEEE INFOCOM - Proceedings of the 27th Conference on Computer Communications, pages 924-932. April 2008.
 Camp, T., Boleng, J. & Davies, V. A survey of mobility models for ad hoc network research. Wireless Communications and Mobile Computing 2, 483-502 (2002).
 Xiaoyan Hong, Mario Gerla, Guangyu Pei, and Ching-Chuan Chiang. 1999. A group mobility model for ad hoc wireless networks. In Proceedings of the 2nd ACM international workshop on Modeling, analysis and simulation of wireless and mobile systems (MSWiM '99). ACM, New York, NY, USA, 53-60.
 Wei-jen Hsu, Thrasyvoulos Spyropoulos, Konstantinos Psounis, and Ahmed Helmy, Modeling Time-variant User Mobility in Wireless Mobile Networks, INFOCOM 2007, May 2007.
 Andrea E. F. Clementi, Francesco Pasquale, Angelo Monti, and Riccardo Silvestri. 2007. Communication in dynamic radio networks. In Proceedings of the twenty-sixth annual ACM symposium on Principles of distributed computing (PODC '07). ACM, New York, NY, USA, 205-214.
 Andrea E.F. Clementi, Claudio Macci, Angelo Monti, Francesco Pasquale, and Riccardo Silvestri. 2008. Flooding time in edge-Markovian dynamic graphs. In Proceedings of the twenty-seventh ACM symposium on Principles of distributed computing (PODC '08). ACM, New York, NY, USA, 213-222.
 Augustin Chaintreau, Abderrahmen Mtibaa, Laurent Massoulie, and Christophe Diot. 2007. The diameter of opportunistic mobile networks. In Proceedings of the 2007 ACM CoNEXT conference (CoNEXT '07). ACM, New York, NY, USA, , Article 12 , 12 pages.
 Stehle, J., Barrat, A. & Bianconi, G. Dynamical and bursty interactions in social networks. Physical Review E 81, 1-4 (2010). Available online at: http://link.aps.org/doi/10.1103/PhysRevE.81.035101