# Weird behaviour when importing a mixed graph from GraphML file

Consider a mixed graph G1 stored in GraphML file:

<graphml>
<graph edgedefault="directed">
<node id="v1"/>
<node id="v2"/>
<node id="v3"/>
<node id="v4"/>
<edge source="v1" target="v2"/>
<edge source="v1" target="v3"/>
<edge source="v2" target="v4"/>
<edge source="v2" target="v4" directed="false"/>
</graph>
</graphml>


Importing it into Mathematica:

Import["G1.graphml", VertexLabels -> Automatic]


produces a directed (i.e. not mixed) graph:

which does not match the graph described in the GraphML file.

Am I missing something obvious here? Is this a bug, and if so, is there a way around it?

• That looks like a bug to me. Not the first one related to Graph as @Szabolcs may confirm. – Henrik Schumacher Aug 23 '18 at 6:22
• I did find GraphML handling to be less than ideal ... a practical solution may be reading the GraphML file as XML and parsing it manually. It shouldn't take more than 30 minutes, perhaps an hour if you're not fluent in these features yet. You can also try converting the GraphML to another format using an external tool, but unfortunately Mathematica has issues with most graph formats ... – Szabolcs Aug 23 '18 at 8:11
• That's what I have resorted to - parsing GraphML file as an XML file manually, since Mathematica's functionality looks so unreliable that it seems that one has to be cautious even when working with simpler (i.e. purely directed or undirected) graphs. – montyynis Aug 28 '18 at 12:27