N
- The label type of nodes in the graph.E
- The label type of edges in the graph.public class ScaleFreeRewire<N,E> extends Rewire<N,E>
The model uses an m parameter, which specifies the number of edges to add from each new node to existing nodes, on each time-step. The initial seed size of the graph, (m_0 in the paper) will be taken as m + 1. The default for m is 1.
In the BA model, m is very rigidly the number of links added. This may be useful for analytical purposes, but does not lead to much variation in the structure of the generated graphs. Other interpretations are possible for m, which deviate slightly from the BA model. E.g. it could be taken as a minimum number of links to add, while considering adding links from the new node to every existing node; or as a maximum number to add. This can be controlled with the "m_mode" parameter (@see m_modes).
An additional 'a' parameter allows an additive bias to be introduced, which gives low-degree (i.e. younger) nodes a better chance - in the spirit of the Dorogovtsev, et al, paper. @see #a
Modifier and Type | Class and Description |
---|---|
static class |
ScaleFreeRewire.m_modes |
Modifier and Type | Field and Description |
---|---|
protected int |
a |
protected int |
m |
protected N[] |
nodes |
protected java.util.Random |
r |
Constructor and Description |
---|
ScaleFreeRewire(Graph<N,E> graph,
EdgeLabeler<N,E> el)
Create a ScaleFreeRewiring instancing, with the default m value.
|
Modifier and Type | Method and Description |
---|---|
protected void |
_init_nodes() |
int |
a() |
ScaleFreeRewire<N,E> |
a(int a)
The 'a' parameter controls the initial attractiveness of a node, along
the lines of the A parameter in the Dorogovtsev, et al, "Structure
of Growing Networks with Preferential Linking", Phys.
|
protected boolean |
add_link(N to_add,
N to) |
void |
add(N to_add)
Add a single node to the graph.
|
protected int |
add(N to_add,
long numlinks,
java.lang.Iterable<N> iter) |
protected boolean |
consider_link(N to_add,
N vi,
long numlinks)
Consider whether to add a link between the new node and the
given existing node.
|
protected void |
link_added(N added,
N vi)
Called when a link is created between 2 nodes.
|
protected static boolean |
m_mode_stop(ScaleFreeRewire.m_modes m_mode,
int m,
int added,
int pass) |
ScaleFreeRewire.m_modes |
m_mode() |
ScaleFreeRewire<N,E> |
m_mode(ScaleFreeRewire.m_modes m_mode) |
ScaleFreeRewire<N,E> |
m_mode(java.lang.String m_mode) |
int |
m() |
ScaleFreeRewire<N,E> |
m(int m)
The 'm' parameter is the number of links each new node will get to
the existing nodes in the graph.
|
protected void |
m0() |
protected java.util.Iterator<N> |
nodes_iterator(int split) |
protected int |
rewire_callback(int split,
int numlinks) |
void |
rewire()
Rewire the whole graph.
|
protected java.util.Random r
protected N[] nodes
protected int m
protected int a
public int m()
public ScaleFreeRewire<N,E> m(int m)
m
- The number of links to add from a new node on every time-step.public int a()
public ScaleFreeRewire<N,E> a(int a)
a
- The initial attractiveness of new nodes.public ScaleFreeRewire.m_modes m_mode()
public ScaleFreeRewire<N,E> m_mode(ScaleFreeRewire.m_modes m_mode)
m_mode
- Whether to interpret m as a maximum, a minimum or strictly
according to BA model, as a precise number of links to add.#m_modes.
public ScaleFreeRewire<N,E> m_mode(java.lang.String m_mode)
m_mode
- Whether to interpret m as a maximum, a minimum or strictly
according to BA model, as a precise number of links to add.#m_modes.
protected void _init_nodes()
protected static boolean m_mode_stop(ScaleFreeRewire.m_modes m_mode, int m, int added, int pass)
protected boolean consider_link(N to_add, N vi, long numlinks)
to_add
- The vertex to be added to the graphvi
- The vertex being considered, v_i in the paper.numlinks
- The number of links that were in the graph,
before any links were added to this new node.protected void link_added(N added, N vi)
protected void m0()
protected java.util.Iterator<N> nodes_iterator(int split)
protected int rewire_callback(int split, int numlinks)
public void rewire()
Rewire
public void add(N to_add)
Rewire
This may (or may not) have different resource usage relative to rewire(). E.g. it may use less memory than rewire(), but more CPU over all if called for a significant number of nodes.
This method is optional, and not all implementations support it.