[Lemon-user] GraphReader format problems

Tapolcai János tapolcai at tmit.bme.hu
Wed Jul 27 01:46:41 CEST 2011


Hi,

I think you need to add labels for arc, too.
Best, János


On 2011.07.26. 17:56, D Haley wrote:
> Hello,
>
> I am having some troubles with the graphreader class, using lemon 1.2.1 on x86-64 installed from the opensuse repositories. I am attempting to read a graph using the following line (condensed):
>
>   ifstream file("graph.txt");
>
>   lemon::GraphReader<Graph>(g,file).nodeMap("values",m).run();
>
> It appears I am not laying out the file as expected -- I have looked at this link (http://lemon.cs.elte.hu/pub/doc/1.2.1/a00002.html), but cannot see where I am going wrong -- any ideas? I don't want any map on top of my edges, just on the nodes themselves.
>
>
>
> When I run the above code, I get the following error:
> Breakpoint 5, lemon::GraphReader<lemon::ListGraph>::readEdges (
>      this=0x7fffffffdc20) at /usr/include/lemon/lgf_reader.h:1868
> 1868	      while (readLine()&&  line>>  c&&  c != '@') {
> (gdb)
> 1869	        line.putback(c);
> (gdb)
> 1871	        std::string source_token;
> (gdb)
> 1872	        std::string target_token;
> (gdb)
> 1874	        if (!_reader_bits::readToken(line, source_token))
> (gdb)
> 1877	        if (!_reader_bits::readToken(line, target_token))
> (gdb)
> 1880	        std::vector<std::string>  tokens(map_num);
> (gdb)
> 1881	        for (int i = 0; i<  map_num; ++i) {
> (gdb)
>
> Breakpoint 3, lemon::GraphReader<lemon::ListGraph>::readEdges (
>      this=0x7fffffffdc20) at /usr/include/lemon/lgf_reader.h:1882
> 1882	          if (!_reader_bits::readToken(line, tokens[i])) {
> (gdb)
> 1883	            std::ostringstream msg;
> (gdb)
> 1884	            msg<<  "Column not found ("<<  i + 1<<  ")";
> (gdb)
> 1885	            throw FormatError(msg.str());
> (gdb)
>
> Running again:
>
> 1882	          if (!_reader_bits::readToken(line, tokens[i])) {
> (gdb) info locals
> i = 0
> source_token = "1"
> target_token = "3"
> tokens = std::vector of length 2, capacity 2 = {"", ""} e = {id = 
> -136536224} map_index = std::vector of length 0, capacity 0 map_num = 
> 2 label_index = -1 c = 49 '1'
>
> graph.txt contents:
>
> @nodes
> label  values
>      1    20
>      2    -4
>      3     0
>      4     0
>      5     9
>      6    -6
>      7     0
>      8     0
>      9     3
>     10    -2
>     11     0
>     12   -20
>
> @arcs
>
>   1  2
>   1  3
>   1  4
>   2  8
>   3  5
>   4  6
>   4  7
>   4  8
>   5  7
>   5 11
>   6  3
>   6  9
>   6 10
>   7  1
>   8 12
>   9 12
> 10 12
> 10  2
> 10  7
> 11 10
> 12 11
>
> _______________________________________________
> Lemon-user mailing list
> Lemon-user at lemon.cs.elte.hu
> http://lemon.cs.elte.hu/mailman/listinfo/lemon-user
_______________________________________________
Lemon-user mailing list
Lemon-user at lemon.cs.elte.hu
http://lemon.cs.elte.hu/mailman/listinfo/lemon-user



More information about the Lemon-user mailing list