NetworkDistanceUpdater

defSim.tools.NetworkDistanceUpdater.check_dissimilarity(network: networkx.classes.graph.Graph, maximum: float, minimum: float = 0)

This function is used to check whether influence is theoretically still possible. For that is checked whether any edge has a dissimilarity value inbetween a certain range of possible values that allow for further influence steps. This range has 1 as the upper limit and a given threshold as lower limit.

Parameters
  • network – The network that is checked.

  • maximum – The upper limit of dissimilarity that makes it possible for agents to influence each other. Only edges with dissimilarity strictly lower than this value allow influence.

  • minimum – The lower limit of dissimilarity that makes it possible for agents to influence each other. Only edges with dissimilarity strictly greater than this value allow influence.

Returns

True if there is still change possible, False otherwise

defSim.tools.NetworkDistanceUpdater.update_dissimilarity(network: networkx.classes.graph.Graph, agents: List[int], calculator: defSim.dissimilarity_component.dissimilarity_calculator.DissimilarityCalculator, **kwargs)

This method recomputes the edges between a certain set of agents and all their neighbors and then modifies the edges between them respectively.

Parameters
  • calculator – An implementation of the DissimilarityCalculator class

  • network – The network that is updated.

  • agents – A list containing the indices of all agents whose edges should be updated.