Example Usage of the Network Class from the pyseldonlib Package#

# Import necessary modules
import pyseldonlib
# Initialize the Network object
network = pyseldonlib.Network(
    model_string="DeGroot",
    neighbour_list=[[1, 2], [0, 2], [0, 1], [4], [3]],
    weight_list=[[0.5, 0.5], [0.5, 0.5], [0.5, 0.5], [1], [1]],
    direction="Incoming"
)
# Print the network details
print(f"Number of agents: {network.n_agents}")
print(f"Edges of 1st index agent: {network.n_edges(1)}")
print(f"Direction: {network.get_direction}")
print(f"Neighbour List: {network.get_neighbours(1)}")
print(f"Weight List: {network.get_weights(1)}")
Number of agents: 5
Edges of 1st index agent: 2
Direction: Incoming
Neighbour List: [0, 2]
Weight List: [0.5, 0.5]