Has the GraphML standard been updated?
I downloaded the Rome database from the link.
The files in it are stored in the "GraphML"
format. However, I am unable to import it into Mathematica or the YEd software. I would like to know what is happening and how to import them correctly. A similar unsolved issue can be found at the following link:
Import["D:/grafo113.28.graphml"]
Import::fmterr: Cannot import data as GraphML format.
Example (grafo113.28.graphml):
<?xml version="1.0" encoding="UTF-8"?>
<!-- This file was written by the internal XML-Handler of Y-Files.-->
<!DOCTYPE graphml SYSTEM "http://www.graphdrawing.org/dtds/graphml.dtd">
<graphml>
<graph edgedefault="undirected" id="G">
<node id="n0"/>
<node id="n1"/>
<node id="n2"/>
<node id="n3"/>
<node id="n4"/>
<node id="n5"/>
<node id="n6"/>
<node id="n7"/>
<node id="n8"/>
<node id="n9"/>
<node id="n10"/>
<node id="n11"/>
<node id="n12"/>
<node id="n13"/>
<node id="n14"/>
<node id="n15"/>
<node id="n16"/>
<node id="n17"/>
<node id="n18"/>
<node id="n19"/>
<node id="n20"/>
<node id="n21"/>
<node id="n22"/>
<node id="n23"/>
<node id="n24"/>
<node id="n25"/>
<node id="n26"/>
<node id="n27"/>
<edge id="e0" source="n1" target="n12"/>
<edge id="e1" source="n12" target="n2"/>
<edge id="e2" source="n12" target="n0"/>
<edge id="e3" source="n0" target="n14"/>
<edge id="e4" source="n14" target="n3"/>
<edge id="e5" source="n20" target="n8"/>
<edge id="e6" source="n3" target="n15"/>
<edge id="e7" source="n3" target="n16"/>
<edge id="e8" source="n16" target="n5"/>
<edge id="e9" source="n3" target="n17"/>
<edge id="e10" source="n3" target="n18"/>
<edge id="e11" source="n19" target="n7"/>
<edge id="e12" source="n7" target="n21"/>
<edge id="e13" source="n4" target="n15"/>
<edge id="e14" source="n21" target="n9"/>
<edge id="e15" source="n9" target="n13"/>
<edge id="e16" source="n9" target="n22"/>
<edge id="e17" source="n22" target="n11"/>
<edge id="e18" source="n23" target="n3"/>
<edge id="e19" source="n18" target="n7"/>
<edge id="e20" source="n18" target="n24"/>
<edge id="e21" source="n24" target="n6"/>
<edge id="e22" source="n25" target="n23"/>
<edge id="e23" source="n25" target="n24"/>
<edge id="e24" source="n25" target="n13"/>
<edge id="e25" source="n19" target="n16"/>
<edge id="e26" source="n25" target="n26"/>
<edge id="e27" source="n26" target="n10"/>
<edge id="e28" source="n27" target="n13"/>
<edge id="e29" source="n27" target="n8"/>
<edge id="e30" source="n7" target="n26"/>
</graph>
</graphml>
It looks like Syed is right. But I'm not sure what's behind the Import
function. So now I don't understand why deleting that line <!DOCTYPE graphml SYSTEM "http://www.graphdrawing.org/dtds/graphml.dtd">
is OK.
<!DOCTYPE...
line and try again. $\endgroup$Import[..., "XML"]
as well, unless specifying"ReadDTD" -> False
. But that option cannot be used withImport[..., "GraphML"]
, so yes: find a way to remove that line. E.g.,ImportString[ StringRiffle[ Select[StringSplit[Import[file, "String"], "\n"], Not@*StringStartsQ["<!DOCTYPE"]], "\n"], "GraphML" ]
$\endgroup$