Class PullPushStrategyRecommenderPropagationMechanism<U extends java.io.Serializable,I extends java.io.Serializable,P>
java.lang.Object
es.uam.eps.ir.relison.diffusion.propagation.PullPushStrategyRecommenderPropagationMechanism<U,I,P>
- Type Parameters:
U- type of the usersI- type of the information piecesP- type of the parameters.
- All Implemented Interfaces:
PropagationMechanism<U,I,P>
public class PullPushStrategyRecommenderPropagationMechanism<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.
With a given probability, it selects a neighbor using recommended links. Otherwise, it recommends any link.
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>>lastIterationsThe list of users in the last iterations.private EdgeOrientationorientationEdge direction of the neighbors to ask for information.private java.util.Map<U,java.util.List<U>>propagationListFor each user, the list of users that user will propagate the information to.private doublerecProbProbability of selecting a recommended link for propagation.private java.util.RandomrngRandom number generator.private intwaitTimeNumber of iterations to wait until a profile can be revisited. -
Constructor Summary
Constructors Constructor Description PullPushStrategyRecommenderPropagationMechanism(int waitTime, double recProb)Constructor.PullPushStrategyRecommenderPropagationMechanism(int waitTime, EdgeOrientation orientation, double recProb)Constructor. -
Method Summary
Modifier and Type Method Description booleandependsOnInformationPiece()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.voidresetSelections(Data<U,I,P> data)It resets the selections that this mechanism did in past iterations.
-
Field Details
-
waitTime
private final int waitTimeNumber of iterations to wait until a profile can be revisited. -
orientation
Edge direction of the neighbors to ask for information. -
propagationList
private final java.util.Map<U extends java.io.Serializable,java.util.List<U extends java.io.Serializable>> propagationListFor 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>> lastIterationsThe list of users in the last iterations. -
recProb
private final double recProbProbability of selecting a recommended link for propagation. -
rng
private final java.util.Random rngRandom number generator.
-
-
Constructor Details
-
PullPushStrategyRecommenderPropagationMechanism
public PullPushStrategyRecommenderPropagationMechanism(int waitTime, double recProb)Constructor.- Parameters:
waitTime- number of iterations to wait until a profile can be revisited.recProb- probability of selecting a recommended link for propagation.
-
PullPushStrategyRecommenderPropagationMechanism
public PullPushStrategyRecommenderPropagationMechanism(int waitTime, EdgeOrientation orientation, double recProb)Constructor.- Parameters:
waitTime- number of iterations to wait until a profile can be revisited.orientation- selection of the visits available for contact.recProb- probability of selecting a recommended link for propagation.
-
-
Method Details
-
getUsersToPropagate
public java.util.stream.Stream<U> getUsersToPropagate(PropagatedInformation information, UserState<U> originUser, Data<U,I,P> data)Description copied from interface:PropagationMechanismSelects the users to which propagate a single piece of information.- Specified by:
getUsersToPropagatein interfacePropagationMechanism<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
Description copied from interface:PropagationMechanismIt resets the selections that this mechanism did in past iterations.- Specified by:
resetSelectionsin interfacePropagationMechanism<U extends java.io.Serializable,I extends java.io.Serializable,P>- Parameters:
data- the data.
-
dependsOnInformationPiece
public boolean dependsOnInformationPiece()Description copied from interface:PropagationMechanismThis indicates whether the selection of the users depends or not on the information piece which we want to propagate.- Specified by:
dependsOnInformationPiecein interfacePropagationMechanism<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.
-