hari_plotter.model module

class hari_plotter.model.ActivityDrivenModel(params: dict[str, Any])[source]

Bases: Model

Model representing the ActivityDriven dynamics.

get_influence(G: Graph) ndarray[source]

Compute and return the influence values for the ActivityDriven model.

Parameters:

G – The graph on which the influence values are to be computed.

Returns:

Array containing the computed influence values.

get_tension(G: Graph, norm_type: str = 'squared') float[source]

Compute and return the tension for the ActivityDriven model.

Parameters:
  • G – The graph on which the tension is to be computed.

  • norm_type – The type of norm used to compute the tension. Can be either ‘abs’ or ‘squared’.

Returns:

The computed tension value.

property load_request: dict[str, Any]

Results will be sent to Graph.from_network on setup

class hari_plotter.model.DeGrootModel(params: dict[str, Any])[source]

Bases: Model

Model representing the DeGroot dynamics.

get_influence(G: Graph) ndarray[source]

Compute and return the influence values for the DeGroot model.

Parameters:

G – The graph on which the influence values are to be computed.

Returns:

Array containing the computed influence values.

get_tension(G: Graph, norm_type: str = 'squared') float[source]

Compute and return the tension for the DeGroot model.

Parameters:
  • G – The graph on which the tension is to be computed.

  • norm_type – The type of norm used to compute the tension. Can be either ‘abs’ or ‘squared’.

Returns:

The computed tension value.

class hari_plotter.model.DeffuantModel(params: dict[str, Any])[source]

Bases: Model

get_influence(G: Graph) ndarray[source]

Abstract method to compute and return the influence values.

get_tension(G: Graph, norm_type: str = 'squared') float[source]

Abstract method to compute and return the tension value.

class hari_plotter.model.Model(params: dict[str, Any])[source]

Bases: ABC

Base abstract class for different types of models.

property dt
abstract get_influence() ndarray[source]

Abstract method to compute and return the influence values.

abstract get_tension() float[source]

Abstract method to compute and return the tension value.

property load_request: dict[str, Any]

Results will be sent to Graph.from_network on setup

property model_type: str
class hari_plotter.model.ModelFactory[source]

Bases: object

classmethod create_model(model_type: str, params: dict[str, Any]) Model[source]

Create a model instance based on the model type and parameters.

Parameters:
  • model_type – The type of the model to create.

  • params – Parameters for the model.

Returns:

An instance of the requested model type.

classmethod from_toml(filename: str) Model[source]

Create a model instance from a TOML configuration file.

Parameters:

filename – Path to the TOML file.

Returns:

An instance of the model defined in the TOML file.

classmethod get_model_class(model_type: str) type[Model][source]

Converts name of the class to the class

classmethod get_model_name(model_class: type[Model]) str[source]

Converts the class to its name

classmethod register(model_type: str)[source]

Decorator for registering model classes with a specific model type.

Parameters:

model_type – The type of the model to register.

Returns:

A decorator function that registers the given class.