bcds.phison.multfailures
Class SequencerDegree<V,E>

java.lang.Object
  extended by bcds.phison.multfailures.ElemsSequencerBase<V,E>
      extended by bcds.phison.multfailures.SequencerDegree<V,E>
All Implemented Interfaces:
ElemsSequencer<V,E>, WithEnvParams

public class SequencerDegree<V,E>
extends ElemsSequencerBase<V,E>

This class arranges nodes in descending order of nodal degree, optionally shuffling the order of nodes having the same degree. It does not implement ElemsSequencer.arrangeDirectedLinks(java.util.Random) or ElemsSequencer.arrangeUndirectedLinks(java.util.Random).

Author:
Juan Segovia S.

Constructor Summary
SequencerDegree()
          Default constructor.
SequencerDegree(TED<V,E> ted, Environ env)
          Creates a new instance and calls setup to complete the initialization.
 
Method Summary
 java.util.List<V> arrangeNodes(java.util.Random rnd)
          Returns all the nodes in the graph sorted by nodal degree, in descending order.
static
<V,E> java.util.SortedMap<java.lang.Integer,java.util.List<V>>
groupByNodalDegree(SimGraph<V,E> g)
          Returns a map where nodes are grouped by their "out" nodal degree.
 
Methods inherited from class bcds.phison.multfailures.ElemsSequencerBase
arrangeDirectedLinks, arrangeUndirectedLinks, getEnviron, getEnvParams, getName, setup
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SequencerDegree

public SequencerDegree()
Default constructor.


SequencerDegree

public SequencerDegree(TED<V,E> ted,
                       Environ env)
Creates a new instance and calls setup to complete the initialization.

Method Detail

arrangeNodes

public java.util.List<V> arrangeNodes(java.util.Random rnd)
Returns all the nodes in the graph sorted by nodal degree, in descending order. If rnd is not null, nodes of the same degree are "shuffled" randomly, so that successive calls will return different results, but always observing that d(v_j) >= d(v_k) for all j,k in [0..N), j < k. If rnd is null, nodes are sorted within their respective group by their "natural" order.

Specified by:
arrangeNodes in interface ElemsSequencer<V,E>
Overrides:
arrangeNodes in class ElemsSequencerBase<V,E>

groupByNodalDegree

public static <V,E> java.util.SortedMap<java.lang.Integer,java.util.List<V>> groupByNodalDegree(SimGraph<V,E> g)
Returns a map where nodes are grouped by their "out" nodal degree. The map is sorted in ascending order by its key, that is, by the out nodal degree. Within each group, nodes are sorted by their "natural" order.