Question: Failed to import the graph with graphlet (gml) format

Here is a graph (g.txt) in Graphlet (gml) format that I threw up with another program. I want to import it by maple. 

I am expecting to do two things:

  • Import the graph correctly;
  • draw the graph according to the vertex position, vertex color, vertex shape and edge color etc. in the file.

This question may come from https://www.mapleprimes.com/questions/235457-How-To-Draw-A-Directed-but-Maybe-Not-Acyclic. My intention is to use this format to efficiently pass graphs and other attributes such as vertex positions, vertex colors, and edge colors. 

However maple doesn't seem to be able to handle them even it cannot handle  the above first point well.

Import ("G:\\test\\g.gml");
# or 
GraphTheory:-ImportGraph ("G:\\test\\g.gml",graphlet)

Error, (in Import) incorrect syntax in parse: unexpected number (near 12th character of parsed string)

Error, (in GraphTheory:-ImportGraph) incorrect syntax in parse: unexpected number (near 12th character of parsed string)

I'm not sure what type of the mistake is here.

 

Mathematica can do it nicely:

g=Import["G:\\test\\g.gml"]

List @@@ PropertyValue[g, VertexLabels]
GraphEmbedding[g]

 

{{8, "x8"}, {12, "b3"}, {14, "x14"}, {2, "b2"}, {13, "x13"}, {5, 
  "r3"}, {7, "r5"}, {9, "r6"}, {11, "x11"}, {6, "r4"}, {1, "b1"}, {15,
   "x15"}, {3, "r1"}, {4, "r2"}, {10, "x10"}}

{{1080, 1440}, {480, 320}, {660, 560}, {420, 160}, {1380, 880}, {1020,
   720}, {720, 880}, {660, 800}, {2160, 0}, {0, 0}, {1500, 
  480}, {1320, 800}, {1800, 240}, {900, 1120}, {1080, 1360}}

PropertyValue[g, VertexStyle]

 

Please Wait...