Why is the output so counterintuitive here? Source and target seem to be mixed up in the dataframe returned by `get_edge_dataframe()`

g = ig.Graph()
g.add_vertices(10)
g.add_edge(source=8, target=4, directed=True)
g.get_edge_dataframe()

Your graph is undirected. To create a directed graph, use g = ig.Graph(directed=True).

Directedness is a property of the graph, not of individual edges. When you set directed=True in add_edge(), it did not change the directedness of the graph. It merely created a new edge attribute named “directed” and set it to True on the newly added edge.

Please see:

https://python.igraph.org/en/stable/api/igraph.Graph.html#add_edge