added node-name cleaning to extract_edges function