Add functions to construct graphs from edges