Arguments

class structure_and_args.GraphArgs(config_filename='config.py')

Bases: object

A class to manage graph arguments and configurations. It is automatically initialized based on the configuration file, which has the default name: “config.py”

# Directories
directory_map

Simple reference for directory mapping, created by create_project_structure.

Type:

type

# Base Attributes
proximity_mode

The mode of determining proximity among nodes, defaults to “knn” (k-nearest neighbors) for simulations. Can be set to ‘experimental’, which requires an edge list to be provided.

Type:

str

edge_list_title

The title or name for the edge list, None by default, to be updated with graph parameters.

Type:

str

dim

The dimensionality of the Euclidean point cloud.

Type:

int

plot_graph_properties

A flag indicating whether to plot graph properties, defaults to False. Properties: degree, clustering and shortest path distribution.

Type:

bool

reconstruct

Indicates whether graph reconstruction is to be performed, defaults to False.

Type:

bool

reconstruction_mode

The mode of graph reconstruction, only relevant if reconstruct is True.

Type:

str

large_graph_subsampling

Indicates whether subsampling of large graphs is enabled, defaults to False.

Type:

bool

max_subgraph_size

The maximum size for subgraphs, defaults to 3000, relevant if subsampling is enabled.

Type:

int

weighted

Indicates if the graph is weighted, defaults to False.

Type:

bool

weighted_threshold

The threshold for weights in a weighted graph, relevant if weighted is True.

Type:

float

false_edges_count

The count of false edges to simulate, if any, defaults to 0.

Type:

int

false_edge_ids

Stores ids of false edges, if needed.

Type:

list

# Image Coloring
colorfile

Path to a file defining colors for nodes or edges, if applicable.

Type:

str

node_ids_map_old_to_new

Maps old node IDs to new ones, None by default.

Type:

type

colorcode

Maps node states to colors, with default mappings provided.

Type:

dict

# Simulation Attributes
_num_points

The number of points (or nodes) in the graph, defaults to 300.

Type:

int

L

Length of the square/cube.

Type:

int

plot_original_image

Flag to plot the original image, relevant for simulations, defaults to False.

Type:

bool

_intended_av_degree

The intended average degree of nodes in the graph, defaults to 6.

Type:

int

id_to_color_simulation

Maps node IDs to colors for simulation purposes, None by default.

Type:

type

# Graph Attributes
sparse_graph

The sparse representation of the graph, None by default.

Type:

type

igraph_graph

The graph represented using the igraph library, None by default.

Type:

type

shortest_path_matrix

A matrix storing the shortest paths between nodes, None by default.

Type:

numpy.ndarray

mean_shortest_path

The mean shortest path length in the graph, None by default.

Type:

type

is_bipartite

Indicates if the graph is bipartite, defaults to False.

Type:

bool

bipartite_sets

The sets of nodes in a bipartite graph, None by default.

Type:

type

average_degree

The average degree of nodes in the graph, initialized to -1.

Type:

int

mean_clustering_coefficient

The mean clustering coefficient of the graph, None by default.

Type:

type

update_proximity_mode()

Updates the proximity mode based on the configuration.

update_args_title()

Updates the generic file title to define each individual graph based on graph attributes

create_project_structure()

Creates and returns a mapping of directory structures, for file organization.

property dim
property false_edges_count
get_config(config_module)

Determines the scenario based on the ‘proximity_mode’ in the configuration and merges configurations accordingly.

Parameters:

config_module (module) – The configuration module containing the ‘base’, ‘experiment’, and ‘simulation’ configurations.

Returns:

A dictionary of merged settings.

Return type:

dict

property intended_av_degree
load_config(config_filename, code_folder)

Loads configuration from a Python file specified by combining the folder path and file name.

Parameters:
  • config_filename (str) – The name of the configuration file.

  • code_folder (str) – The folder where the configuration file is located.

Returns:

A module object containing the configurations.

Return type:

module

property num_points
property proximity_mode
set_edge_list_title(title)
update_args_title()
update_proximity_mode()
structure_and_args.create_project_structure()

Create the project directory structure and return a dictionary mapping directory names to their corresponding paths.