Calculate the largest connected component of a network
calculate_largest_component.RdThis function takes a spatial network represented as an sf object, converts it into a graph format,
identifies all connected components, and extracts the largest one.