GraphML reader: Attributes of type string

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

GraphML reader: Attributes of type string

Jens Müller-2
When running my program (graphml.cpp/hpp), I get:

./batch-c-delaunay-10000: line 7:  2801 Abgebrochen
./separator -i /algodaten/separator/graphs/large/c-delaunay.graphml -f
/algodaten/separator/graphs/large/output/c-delaunay-dj-noopt.csv
--best-fundamental-cycle -p -d
TRACE - main() entered
TRACE - command line parsed
TRACE - options analysed and stored
terminate called after throwing an instance of 'boost::parse_error'
   what():  parse error: on line 6680, column 1: invalid value "

         " for key label of type double



 From the file:

<?xml version="1.0" encoding="UTF-8"?>
<graphml>
<key id="d0" for="node" attr.type="string" attr.name="label" />
<key id="d1" for="node" attr.type="double" attr.name="coord1" />
<key id="d2" for="node" attr.type="double" attr.name="coord2" />
<key id="d3" for="node" attr.type="double" attr.name="z" />
<key id="d4" for="edge" attr.type="double" attr.name="label" />
<graph edgedefault="directed">
<node id="n0">
         <data key="d0">id="n4791" x="179.806" y="966.718"       </data>
<data key="d1">194.806</data>   <data key="d2">981.718</data>   <data
key="d3">0.0</data></node><node id="n1">  <data key="d0">id="n4
181" x="729.744" y="822.675"       </data> <data key="d1">744.744</data>
   <data key="d2">837.675</data>
         <data key="d3">0.0</data></node><node id="n2">  <data
key="d0">id="n3194" x="797.235" y="634.314"       </data> <data
key="d1">812.235</data>   <data key="d2">649.314</data>   <data
key="d3">0.0</d
ata></node><node id="n3">

 From the program:



node_map<std::string> label_map(g); // throw-away stuff
...
dynamic_properties dp;
...
dp.property("label", make_leda_node_property_map(label_map));
...
read_graphml(in, g, dp);


Why does the GraphML reader try to parse the d0 (label) attribute as a
double?!

Thanks a lot!

Jens


Reply | Threaded
Open this post in threaded view
|

Re: GraphML reader: Attributes of type string

Tiago de Paula Peixoto
Jens Müller <[hidden email]> writes:

> When running my program (graphml.cpp/hpp), I get:
>
> ./batch-c-delaunay-10000: line 7:  2801 Abgebrochen
> ./separator -i /algodaten/separator/graphs/large/c-delaunay.graphml -f
> /algodaten/separator/graphs/large/output/c-delaunay-dj-noopt.csv
> --best-fundamental-cycle -p -d
> TRACE - main() entered
> TRACE - command line parsed
> TRACE - options analysed and stored
> terminate called after throwing an instance of 'boost::parse_error'
>    what():  parse error: on line 6680, column 1: invalid value "
>
>          " for key label of type double
>
>
>
>  From the file:
[...]

> Why does the GraphML reader try to parse the d0 (label) attribute as a
> double?!

It seems to me not that it is trying to parse the label as a double, but
that the label value is invalid, i.e. empty. Could you send the whole
file (preferebly) or at least the line (6680) where the error happens,
so that I can take a closer look?

Thanks,
Tiago

--
Tiago de Paula Peixoto <[hidden email]>

attachment0 (306 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: GraphML reader: Attributes of type string

Tiago de Paula Peixoto
"Tiago de Paula Peixoto" <[hidden email]> writes:

> Jens Müller <[hidden email]> writes:
>
>> When running my program (graphml.cpp/hpp), I get:
>>
>> ./batch-c-delaunay-10000: line 7:  2801 Abgebrochen
>> ./separator -i /algodaten/separator/graphs/large/c-delaunay.graphml -f
>> /algodaten/separator/graphs/large/output/c-delaunay-dj-noopt.csv
>> --best-fundamental-cycle -p -d
>> TRACE - main() entered
>> TRACE - command line parsed
>> TRACE - options analysed and stored
>> terminate called after throwing an instance of 'boost::parse_error'
>>    what():  parse error: on line 6680, column 1: invalid value "
>>
>>          " for key label of type double
>>
>>
>>
>>  From the file:
>
> [...]
>
>> Why does the GraphML reader try to parse the d0 (label) attribute as a
>> double?!
>
> It seems to me not that it is trying to parse the label as a double, but
> that the label value is invalid, i.e. empty. Could you send the whole
> file (preferebly) or at least the line (6680) where the error happens,
> so that I can take a closer look?
According to the file you sent my by private mail, around line 6680
there is the following (white space and newlines omitted):

    <data key="d4"></data>

And 'd4' is the key for a property of type double named 'label' (hence
the confusing error message). Such an empty entry cannot be converted to
a double value, so indeed the file is invalid...

Cheers,
Tiago

--
Tiago de Paula Peixoto <[hidden email]>

attachment0 (306 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: GraphML reader: Attributes of type string

Jens Müller-2
Tiago de Paula Peixoto schrieb:

>>> terminate called after throwing an instance of 'boost::parse_error'
>>>    what():  parse error: on line 6680, column 1: invalid value "
>>>
>>>          " for key label of type double
>>>
>>>
>>>
>>>  From the file:
>> [...]
>>
>>> Why does the GraphML reader try to parse the d0 (label) attribute as a
>>> double?!
>> It seems to me not that it is trying to parse the label as a double, but
>> that the label value is invalid, i.e. empty. Could you send the whole
>> file (preferebly) or at least the line (6680) where the error happens,
>> so that I can take a closer look?
>
> According to the file you sent my by private mail, around line 6680
> there is the following (white space and newlines omitted):
>
>     <data key="d4"></data>
>
> And 'd4' is the key for a property of type double named 'label' (hence
> the confusing error message). Such an empty entry cannot be converted to
> a double value, so indeed the file is invalid...
>
> Cheers,
> Tiago

OK, thanks a lot.

I renamed the property to label2 to avoid confusion. Is it possible to
have attributes with the same name for nodes and edges?

And maybe the error  message should mention for which kind of graph
element the attribute is ...

Cheers,

Jens


Reply | Threaded
Open this post in threaded view
|

Re: GraphML reader: Attributes of type string

Tiago de Paula Peixoto
Jens Müller <[hidden email]> writes:
> OK, thanks a lot.
>
> I renamed the property to label2 to avoid confusion. Is it possible to
> have attributes with the same name for nodes and edges?

Yes, it should be possible.

> And maybe the error  message should mention for which kind of graph
> element the attribute is ...

Yes that would be clearer. I'll see if I get around to it. (of course,
patches are always welcome :-)

Cheers,
Tiago

--
Tiago de Paula Peixoto <[hidden email]>

attachment0 (306 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: GraphML reader: Attributes of type string

Jens Müller-2
Tiago de Paula Peixoto schrieb:
> Jens Müller <[hidden email]> writes:
>> OK, thanks a lot.
>>
>> I renamed the property to label2 to avoid confusion. Is it possible to
>> have attributes with the same name for nodes and edges?
>
> Yes, it should be possible.


And the dynamic_properties object distinguishes them with some tag, right?


Reply | Threaded
Open this post in threaded view
|

Re: GraphML reader: Attributes of type string

Tiago de Paula Peixoto
Jens Müller <[hidden email]> writes:

> Tiago de Paula Peixoto schrieb:
>> Jens Müller <[hidden email]> writes:
>>> OK, thanks a lot.
>>>
>>> I renamed the property to label2 to avoid confusion. Is it possible
>>> to have attributes with the same name for nodes and edges?
>>
>> Yes, it should be possible.
>
>
> And the dynamic_properties object distinguishes them with some tag,
> right?
It distinguishes them with the key type (vertex or edge descriptor, or a
graph_property tag).

Cheers,
Tiago

--
Tiago de Paula Peixoto <[hidden email]>

attachment0 (306 bytes) Download Attachment