GDS Import/Export of UNDIRECTED Graph

Hello,
I am still struggling with very basic things trying to use Neo4j and the Graph Data Science Package.
I have a Neo4j databased containing amongst other things people nodes. Following Neo4j graph database designs best practices, in the database the Person->Person relationship although undirected is represented by just 1 directed relationship and queried as undirected (e.g. (a)-[:KNOWS]->(b)).
Now when I project the database into a GDS graph using native projection, I set the relationship orientation to UNDIRECTED. Once I compute all the metrics I need, I export the graph with the GDS gds.graph.export() procedure, create a Database out of it and use the APOC procedure apoc.export.graphml.all()procedure to save that as a GML file.
Now, when the graph is exported, each UNDIRECTED relationships is converted automatically into 2 directed relationships (would be nice to have some control here...). (e.g. (a)-[:KNOWS]->(b) and (b)-[:KNOWS]->(a))
But it gets worse. When I want to reimport the GML file into a database, and project it into a GDS graph, if I project it as UNDIRECTED, I get double relationships! Because both (a)-[:KNOWS]->(b) and (b)-[:KNOWS]->(a) are each converted into an UNDIRECTED relationship!
If I project as NATURAL, then I can't use the algorithm requiring UNDIRECTED relationships.
I can't find a clean way to do this, which seems like a common use case.
Any help would be appreciated. Thank you in advance

Neo4j Desktop: 1.5.7
Neo4j DBMS: 5.4.0
APOC version: 5.4.1
GDS version: 2.3.1
Python Neo4j client: 5.4.0
Python GDS client: 1.6

Hi Minrt,

What you are seeing is a result of how Neo4j addresses undirected graphs. Under the hood they are managed as you see, with 2 complimentary directed relationships. When you then project as undirected, each of the relationships is reproduced as undirected.

The following code will allow you to leverage the apoc library to merge the relationships to a single relationship.

MATCH (a)-[r1:KNOWS]->(b)<-[r2:KNOWS]-(a)
CREATE (a)-[r:RELATIONSHIP_TYPE]->(b)
SET r = apoc.map.merge(r1, r2)
WITH r1, r2, r
DELETE r1, r2
RETURN r

Thank you. I have a question though. When the undirected relationship is exported and written as 2 relationships are the 2 relationships in the same direction?
Shouldn't the first MATCH statement be
MATCH (a)-[r1:KNOWS]->(b)-[r2:KNOWS]->(a) instead to account for(a)->(b) and (b)->(a)?
I ended up doing something similar with the following query suppressing one of the 2 relationships (the one going from high node ID to low node ID)

// For each pair of members, drop one of the two Member to Member relationships
MATCH (m1:Member)-[m2m:PARTNERED_WITH]-(m2:Member)
WITH m1, m2, collect(m2m) AS m2ms
WHERE size(m2ms) > 1
UNWIND m2ms AS rel
WITH rel
WHERE endNode(rel) > startNode(rel)
DELETE rel