Synthia
Generic and flexible data structure generator
examples.graphs.BarabasiAlbert< T > Class Template Reference

Detailed Description

Generates a graph following the Barabási–Albert model.

Such a graph is generated by first picking a number of vertices. For each new vertex n' added to the graph, an edge is added to an existing node n with probability dn/D, where dn is the current degree of n and D is the sum of the degrees of all pre-existing vertices.

The resulting graph has the property of being scale-free: it contains few vertices with high degree, and many vertices with low degree. An example of a graph generated by this program is the following:

Graph

In the source code, this graph is merely printed to the console in the DOT format of the Graphviz graph rendering tool.

Author
Sylvain Hallé

Definition at line 54 of file BarabasiAlbert.java.

Inheritance diagram for examples.graphs.BarabasiAlbert< T >:

Public Member Functions

 BarabasiAlbert (Picker< Node< T >> node_picker, Picker< Integer > size, Reactive< Float, Boolean > coin)
 
Node< T > pick ()
 Picks an object. More...
 
Picker< Node< T > > duplicate (boolean with_state)
 Creates a copy of the picker. More...
 
- Public Member Functions inherited from ca.uqac.lif.synthia.tree.GraphPicker< T >
 GraphPicker (Picker< Node< T >> node_picker, Picker< Integer > size)
 
Set< Node< T > > getNodes ()
 Gets the set of nodes in the last graph generated. More...
 
int getMaxDegree ()
 Gets the maximum out degree in a set of nodes in the last graph generated. More...
 
void reset ()
 Puts the picker back into its initial state. More...
 

Static Public Member Functions

static void main (String[] args)
 

Protected Attributes

Reactive< Float, Boolean > m_coin
 
- Protected Attributes inherited from ca.uqac.lif.synthia.tree.GraphPicker< T >
Picker< Node< T > > m_nodePicker
 
Picker< Integer > m_size
 
Set< Node< T > > m_nodes
 

Additional Inherited Members

- Protected Member Functions inherited from ca.uqac.lif.synthia.tree.GraphPicker< T >
void connect (Node< T > n1, Node< T > n2)
 Connects two nodes in a graph. More...
 

Constructor & Destructor Documentation

◆ BarabasiAlbert()

examples.graphs.BarabasiAlbert< T >.BarabasiAlbert ( Picker< Node< T >>  node_picker,
Picker< Integer >  size,
Reactive< Float, Boolean >  coin 
)

Definition at line 73 of file BarabasiAlbert.java.

Member Function Documentation

◆ duplicate()

Picker<Node<T> > examples.graphs.BarabasiAlbert< T >.duplicate ( boolean  with_state)

Creates a copy of the picker.

Parameters
with_stateIf set to false, the returned copy is set to the class' initial state (i.e. same thing as calling the picker's constructor). If set to true, the returned copy is put into the same internal state as the object it is copied from.
Returns
The copy of the picker

Implements ca.uqac.lif.synthia.Picker< T >.

Definition at line 112 of file BarabasiAlbert.java.

◆ main()

static void examples.graphs.BarabasiAlbert< T >.main ( String[]  args)
static

Definition at line 56 of file BarabasiAlbert.java.

◆ pick()

Picks an object.

Typically, this method is expected to return non-null objects; a null return value is used to signal that no more objects will be produced. That is, once this method returns null, it should normally return null on all subsequent calls.

Returns
The object

Implements ca.uqac.lif.synthia.Picker< T >.

Definition at line 80 of file BarabasiAlbert.java.

Member Data Documentation

◆ m_coin

Reactive<Float,Boolean> examples.graphs.BarabasiAlbert< T >.m_coin
protected

Definition at line 71 of file BarabasiAlbert.java.


The documentation for this class was generated from the following file: