|
From: <li...@gm...> - 2005-07-26 08:05:23
|
Hello again,
I cleaned the code up a little bit, and added a catch for catching
null parameters (for the classes). Unless someone points out an
obvious flaw I'll consider it finished, and probably won't be touching
the code anymore.
If you (repast developers) want to add it to Repast, feel free to use
it. If you add it, you might want to add the following code to the
NetworkFactory class:
=09/**
=09 *=20
=09 * Creates a Barabasi-Albert network by initially connecting a given
number of nodes to each other, and then
=09 * incrementally connecting the other nodes. Each new node is
connected with a preference towards well-connected
=09 * nodes.
=09 *=20
=09 * @param size The number of nodes in the network
=09 * @param numContacts The number of connections each node should make
to other nodes
=09 * @param numInitialNodes The number of nodes initially in the network
=09 * @param node The node class
=09 * @param edge The edge class
=09 * @return A List of connected nodes
=09 */
=09public static List createBarabasiAlbertNetwork(int size, int
numContacts, int numInitialNodes, Class node,
=09=09=09Class edge) {
=09=09BarabasiAlbertNet net =3D new BarabasiAlbertNet(size, numContacts,
numInitialNodes, node, edge);
=09=09List list =3D null;
=09=09try {
=09=09=09list =3D net.createBarabasiAlbertNet();
=09=09} catch (IllegalAccessException ex) {
=09=09=09SimUtilities.showError("Error creating ScaleFreeNet", ex);
=09=09=09System.exit(0);
=09=09} catch (InstantiationException ex) {
=09=09=09SimUtilities.showError("Error creating ScaleFreeNet", ex);
=09=09=09System.exit(0);
=09=09}
=09=09return list;
=09}
Bj=F6rn Lijnema
On 7/25/05, Laszlo Gulyas <lg...@ai...> wrote:
> Hi,
>=20
> Back in 2001 I was in e-mail correspondence with Prof. Barabasi, and
> asked the same question. His answer was that they were always using
> a fully connected initial network, even though 'it should work' with
> other configurations, too.
>=20
> I hope this helps,
>=20
> -- g
> --
> Gulyas Laszlo | Laszlo Gulyas
> kut.ig. | dir. of research
> AITIA Rt. | AITIA Inc.
>=20
> <quote who=3D"Bj=F6rn Lijnema">
> > Hello everyone,
> >
> > I managed to find some time to write the Barabasi-Albert network
> > generator I mentioned on this list a few weeks back. (Actually I
> > called it a scale free network generator, but Laszlo Gulyas pointed
> > out my error). I'm afraid it was a bit of a rush job, but I think it
> > should work correctly.
> >
> > There is one issue though, in Emergence of Scaling in Random Networks
> > Barabasi and Albert say that the network can have a small number of
> > initial vertices, however they do not mention anything about
> > connecting those initial vertices to each other.
> >
> > This would mean, with their formula (the probability formula of the
> > probability for a new vertex being connected to an existing vertex i
> > being the number of i's edges divided by the total number of edges)
> > that you will get unconnected vertices if the number of initial
> > vertices is not equal to the number of edges each vertex has.
> >
> > Of the initial vertices, those that do not have a connection after the
> > first new vertex has been connected, will never get one since the
> > probability that a new vertex will connect to them is always zero.
> >
> > I chose to just connect all initial nodes to each other, mainly
> > because I really didn't know what to do. I noticed that JUNG
> > (jung.sf.net) chose another way to go, by changing p =3D degree(v) / |E=
|
> > to p =3D (degree(v) + 1) / (|E| + |V|)
> >
> >
> > If someone could look over my code and point out/correct any errors
> > I've made, and make suggestions for the initial nodes problem, I would
> > be most thankful.
> >
> >
> > Bj=F6rn Lijnema
> >
>=20
>=20
>
|