Class PullPushStrategyPureRecommenderPropagationMechanism<U extends java.io.Serializable,​I extends java.io.Serializable,​P>

java.lang.Object
es.uam.eps.ir.relison.diffusion.propagation.PullPushStrategyPureRecommenderPropagationMechanism<U,​I,​P>
Type Parameters:
U - type of the users.
I - type of the information pieces.
P - type of the parameters.
All Implemented Interfaces:
PropagationMechanism<U,​I,​P>

public class PullPushStrategyPureRecommenderPropagationMechanism<U extends java.io.Serializable,​I extends java.io.Serializable,​P>
extends java.lang.Object
implements PropagationMechanism<U,​I,​P>
Propagation mechanism for the so-called rumour spreading propagation mechanism. Following this strategy, each user selects a user each iteration: he catches the information from such user, and shares with him the information he has. It is a combination of the pull and push propagation mechanisms. A certain amount of time has to pass before a neighbor is selected again. This variant only allows propagating information through recommended links.

Reference: A. Demers, D. Greene, C. Hauser, W. Irish, J. Larson. Epidemic algorithms for replicated database maintenance. ACM PODC 1987, pp. 1-12 (1987)

  • Field Summary

    Fields 
    Modifier and Type Field Description
    private java.util.Map<U,​java.util.List<U>> lastIterations
    The list of users in the last iterations
    private EdgeOrientation orientation
    The orientation for selecting the neighborhood.
    private java.util.Map<U,​java.util.List<U>> propagationList
    For each user, the list of users that user will propagate the information to.
    private int waitTime
    Number of iterations to wait until a profile can be revisited
  • Constructor Summary

    Constructors 
    Constructor Description
    PullPushStrategyPureRecommenderPropagationMechanism​(int waitTime, EdgeOrientation orientation)
    Constructor.
  • Method Summary

    Modifier and Type Method Description
    boolean dependsOnInformationPiece()
    This indicates whether the selection of the users depends or not on the information piece which we want to propagate.
    java.util.stream.Stream<U> getUsersToPropagate​(PropagatedInformation information, UserState<U> originUser, Data<U,​I,​P> data)
    Selects the users to which propagate a single piece of information.
    void resetSelections​(Data<U,​I,​P> data)
    It resets the selections that this mechanism did in past iterations.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • waitTime

      private final int waitTime
      Number of iterations to wait until a profile can be revisited
    • propagationList

      private java.util.Map<U extends java.io.Serializable,​java.util.List<U extends java.io.Serializable>> propagationList
      For each user, the list of users that user will propagate the information to.
    • lastIterations

      private final java.util.Map<U extends java.io.Serializable,​java.util.List<U extends java.io.Serializable>> lastIterations
      The list of users in the last iterations
    • orientation

      private final EdgeOrientation orientation
      The orientation for selecting the neighborhood.
  • Constructor Details

  • Method Details

    • getUsersToPropagate

      public java.util.stream.Stream<U> getUsersToPropagate​(PropagatedInformation information, UserState<U> originUser, Data<U,​I,​P> data)
      Description copied from interface: PropagationMechanism
      Selects the users to which propagate a single piece of information.
      Specified by:
      getUsersToPropagate in interface PropagationMechanism<U extends java.io.Serializable,​I extends java.io.Serializable,​P>
      Parameters:
      information - the information piece to propagate.
      originUser - the user who propagates the information piece.
      data - the complete data for the simulation.
      Returns:
      the stream of users to which propagate the single piece of information.
    • resetSelections

      public void resetSelections​(Data<U,​I,​P> data)
      Description copied from interface: PropagationMechanism
      It resets the selections that this mechanism did in past iterations.
      Specified by:
      resetSelections in interface PropagationMechanism<U extends java.io.Serializable,​I extends java.io.Serializable,​P>
      Parameters:
      data - the data.
    • dependsOnInformationPiece

      public boolean dependsOnInformationPiece()
      Description copied from interface: PropagationMechanism
      This indicates whether the selection of the users depends or not on the information piece which we want to propagate.
      Specified by:
      dependsOnInformationPiece in interface PropagationMechanism<U extends java.io.Serializable,​I extends java.io.Serializable,​P>
      Returns:
      true if it depends on the information piece, false if it does not.