[Lemon-user] remark on graphwriter
Tapolcai János
tapolcai at tmit.bme.hu
Sat Jan 8 11:42:08 CET 2011
Hi Alpar,
> Could you please check it again if DigraphWriter works correctly?
Yes, it works correctly. In brief, I have calculated some spanning trees and increment the cost along the edges of these trees. Depending on which edge belongs to which spanning tree I got different edge costs.
> > (1) the GraphReader writing a warning message, when it reads the label
> "@arcs",
>
> * First of all, I think it always a bad idea from a library to
> write any kind warning. Remember, the "user" of the library is
> the developer and not the end user of the software. Thus a
> warning like this should be sent to the developer, not to the
> user. An alternative could be to use the LEMON_DEBUG or
> LEMON_ASSERT macro to check it. However,
Ok, I got your point. In this case my suggestion is to throw an exception if a GraphReader parses label "@arcs". The user can still hack the input file by replacing it to "@edges".
> * @arcs and @edged are fully equivalent by design, because test
> graphs and the output of the well known graph generators are
> very often used to test both undirected and directed graph
> algorithms.
I am not getting your point. Do you mean this issue is also confusing in the test graphs and in other well know graph generators?
> * Therefore it isn't clear who should emit a warning. I think the
> mistake was done when you wrote the undirected graph with
> DigraphWriter and not when you read it.
> What follows is that
> DigraphWriter should warn you when you use it with an undirected
> graph. BUT, undirected graphs are required to be fully
> compatible with directed graphs, thus this exception would also
> be quite odd.
>
> So I currently can't see any better than warn people to take care of
> this issue.
Another option is to use different file extension for Graphs and Digraphs.
> > (2) a new Reading Rule for GraphReader named simpleGraph(), which
> > filters the duplicated edges when parsing the lgf file.
>
> Which 'cost' value should be kept when removing the parallel edges?
You can define the operator as a parameter of the function, and the default operation can be averaging.
>
> Once again, the mistake was made at writing, not at reading.
I think, it is easy to make such a mistake, and hard to identify.
Best,
János
More information about the Lemon-user
mailing list