nullmodels
Generate randomised reference models for a temporal graph edgelist
Functions
| Function | Description |
|---|
permuted_timestamps_model | Returns a DataFrame with the time column shuffled. |
shuffle_column | Returns an edgelist with a given column shuffled. Exactly one of col_number or col_name should be specified. |
shuffle_multiple_columns | Returns an edgelist with given columns shuffled. Exactly one of col_numbers or col_names should be specified. |
Function Details
Signature: permuted_timestamps_model(graph_df, time_col=None, time_name=None, inplace=False, sorted=False)
Returns a DataFrame with the time column shuffled.
Parameters
| Name | Type | Default | Description |
|---|
graph_df | DataFrame | - | The input DataFrame representing the graph. |
inplace | bool, optional | False | If True, shuffles the time column in-place. Otherwise, creates a copy of the DataFrame. Default is False. |
sorted | bool, optional | False | If True, sorts the DataFrame by the shuffled time column. Default is False. |
time_col | int, optional | None | The column number of the time column to shuffle. Default is None. |
time_name | str, optional | None | The column name of the time column to shuffle. Default is None. |
Signature: shuffle_column(graph_df, col_number=None, col_name=None, inplace=False)
Returns an edgelist with a given column shuffled. Exactly one of col_number or col_name should be specified.
Parameters
| Name | Type | Default | Description |
|---|
col_name | str, optional | None | The column name to shuffle. Default is None. |
col_number | int, optional | None | The column number to shuffle. Default is None. |
graph_df | DataFrame | - | The input DataFrame representing the timestamped edgelist. |
inplace | bool, optional | False | If True, shuffles the column in-place. Otherwise, creates a copy of the DataFrame. Default is False. |
Returns
| Type | Description |
|---|
| DataFrame | The shuffled DataFrame with the specified column. |
Raises
| Exception | Description |
|---|
AssertionError | If neither col_number nor col_name is provided. |
AssertionError | If both col_number and col_name are provided. |
Signature: shuffle_multiple_columns(graph_df, col_numbers=None, col_names=None, inplace=False)
Returns an edgelist with given columns shuffled. Exactly one of col_numbers or col_names should be specified.
Parameters
| Name | Type | Default | Description |
|---|
col_names | list, optional | None | The list of column names to shuffle. Default is None. |
col_numbers | list, optional | None | The list of column numbers to shuffle. Default is None. |
graph_df | DataFrame | - | The input DataFrame representing the graph. |
inplace | bool, optional | False | If True, shuffles the columns in-place. Otherwise, creates a copy of the DataFrame. Default is False. |
Returns
| Type | Description |
|---|
| DataFrame | The shuffled DataFrame with the specified columns. |
Raises
| Exception | Description |
|---|
AssertionError | If neither col_numbers nor col_names are provided. |
AssertionError | If both col_numbers and col_names are provided. |