Some work on preferential attachement generators.
Modified the old PreferentialAttachment to correctly use the random generator of GeneratorBase (there was a bug if one changed the random seed, it was not taken into account). Also added a Barabàsi-Albert generator (BarabasiAlbertGenerator ...) that does exaclty the same job but can produce graphs, not only trees. Indeed the generator adds one node at each call to nextEvents(), for this node it can add one edge (chosen randomly, with a bias toward node with high degrees). However doing so creates a tree. One can now make two ore more edges for each node added. The number of edges generated at each node can be set. It can also be chosen randomly (uniformly this time). The BarabasiAlbertGenerator is stricly the same as the PreferentialAttachmentGenerator when the number of edges added per node is one. We can however keep the old generator for compatibility reasons, or replace it by the BarabasiAlbertGenerator by changing the name of one of the two.
Showing
- src/org/graphstream/algorithm/generator/BarabasiAlbertGenerator.java 211 additions, 0 deletions...phstream/algorithm/generator/BarabasiAlbertGenerator.java
- src/org/graphstream/algorithm/generator/PreferentialAttachmentGenerator.java 4 additions, 5 deletions.../algorithm/generator/PreferentialAttachmentGenerator.java
Please register or sign in to comment