nullmodels

Generate randomised reference models for a temporal graph edgelist

Functions

FunctionDescription
permuted_timestamps_modelReturns a DataFrame with the time column shuffled.
shuffle_columnReturns an edgelist with a given column shuffled. Exactly one of col_number or col_name should be specified.
shuffle_multiple_columnsReturns an edgelist with given columns shuffled. Exactly one of col_numbers or col_names should be specified.

Function Details

permuted_timestamps_model

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

NameTypeDefaultDescription
graph_dfDataFrame-The input DataFrame representing the graph.
inplacebool, optionalFalseIf True, shuffles the time column in-place. Otherwise, creates a copy of the DataFrame. Default is False.
sortedbool, optionalFalseIf True, sorts the DataFrame by the shuffled time column. Default is False.
time_colint, optionalNoneThe column number of the time column to shuffle. Default is None.
time_namestr, optionalNoneThe column name of the time column to shuffle. Default is None.

shuffle_column

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

NameTypeDefaultDescription
col_namestr, optionalNoneThe column name to shuffle. Default is None.
col_numberint, optionalNoneThe column number to shuffle. Default is None.
graph_dfDataFrame-The input DataFrame representing the timestamped edgelist.
inplacebool, optionalFalseIf True, shuffles the column in-place. Otherwise, creates a copy of the DataFrame. Default is False.

Returns

TypeDescription
DataFrameThe shuffled DataFrame with the specified column.

Raises

ExceptionDescription
AssertionErrorIf neither col_number nor col_name is provided.
AssertionErrorIf both col_number and col_name are provided.

shuffle_multiple_columns

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

NameTypeDefaultDescription
col_nameslist, optionalNoneThe list of column names to shuffle. Default is None.
col_numberslist, optionalNoneThe list of column numbers to shuffle. Default is None.
graph_dfDataFrame-The input DataFrame representing the graph.
inplacebool, optionalFalseIf True, shuffles the columns in-place. Otherwise, creates a copy of the DataFrame. Default is False.

Returns

TypeDescription
DataFrameThe shuffled DataFrame with the specified columns.

Raises

ExceptionDescription
AssertionErrorIf neither col_numbers nor col_names are provided.
AssertionErrorIf both col_numbers and col_names are provided.