add_edge and (still) not existing vertex(es)

Hi everyone,
I have a CSV file with the following line(s):
ID NAME CITY ISMANAGER MGRID
where ID is a unique string and represents an employee with her name,city and is_manager attributes, followed by another ID for her manager.
I hoped I could create an edge and implicitely its two vertex if any of them was missing but that does not seem to be the case.
Is there a way for add_edge or similar function to silently create any vertex that does not exist?
To make things slightly more difficult :frowning: there might be some MGRIDs that do not have a record describing their attributes (for people reporting out of country).
Thank you for any solution.

While waiting for some kind expert I’ve been experimenting and am really stumped because of the last problem described.

In my program I create a vertex for every record I find and set aside a tuple in a list describing the ID - MGRID future edge.

Thought I could just use this tuple list at the end to add all edges I had accumulated but the hundred records or so which contain a MGRID that is NOT a vertex of the graph makes my program crash :frowning:
Can you please help?

I have this in the loop traversing the CSV file:

            v = g.add_vertex(name=cleanId)
            # add attributes to the vertex
            v["label"] = cleanName
            v["city"] = cleanCity
            v["ismanager"] = cleanIsMgr
            # add the edge to edges list using name of vertices
            edgelist.append(tuple((cleanIdMgr, cleanId)))

and then at the end of the loop: g.add_edges(edgelist)

which gives an error as soon as it reaches one of the tuples that has a MGRID which is not a vertex