[Lemon-user] GraphCopy - directed vs. undirected
Mitcsenkov Attila
mitcsenkov at tmit.bme.hu
Wed Feb 3 19:03:55 CET 2010
Hi,
Thanks for all of you (Balazs, Peter, Alpar) - all the comments were useful, now the graphcopy is working properly.
I thought that finally I succeeded upgrading my program to Lemon 1.x; everything is almost fine.
But I have on mystical error message that I do not understand, at lemon/adaptors.h, at this line (3435):
typedef typename IN::Value Value;
The error message that Visual Studio 2008 produces:
2>C:\Users\Attila\Documents\Visual Studio 2008\Projects\lemon-1.1.1\lemon/adaptors.h(3435) : error C2146: syntax error : missing ';' before identifier 'Value'
2> C:\Users\Attila\Documents\Visual Studio 2008\Projects\lemon-1.1.1\lemon/adaptors.h(3479) : see reference to class template instantiation 'lemon::SplitNodes<DGR>::CombinedNodeMap<<unnamed-symbol>,<unnamed-symbol>>' being compiled
2> C:\Users\Attila\Documents\Visual Studio 2008\Projects\lemon-1.1.1\lemon/adaptors.h(3597) : see reference to class template instantiation 'lemon::SplitNodes<DGR>' being compiled
2>C:\Users\Attila\Documents\Visual Studio 2008\Projects\lemon-1.1.1\lemon/adaptors.h(3435) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
2>C:\Users\Attila\Documents\Visual Studio 2008\Projects\lemon-1.1.1\lemon/adaptors.h(3435) : error C2868: 'lemon::SplitNodes<DGR>::CombinedNodeMap<<unnamed-symbol>,<unnamed-symbol>>::Value' : illegal syntax for using-declaration; expected qualified-name
And then I have a lot of error messages from the next 40-50 lines of that header file. Don't know why... :(
(The messages are generated while compiling my main.cpp, but without any reference to my files. The adaptors.h is included in 3 of my headers, and those are included in main.cpp)
Simply I'm lost, now I have no idea what else information to tell here about it. I'm trying to figure out for 1-2 hours now, but absolutely no idea.
Attila
-----Original Message-----
From: Balazs Dezso [mailto:deba.mf at gmail.com]
Sent: Tuesday, February 02, 2010 11:25 PM
To: lemon-user at lemon.cs.elte.hu
Cc: Mitcsenkov Attila
Subject: Re: [Lemon-user] GraphCopy - directed vs. undirected
Hi,
I could make directed copy of undirected graph, my code is the following:
#include <lemon/smart_graph.h>
#include <lemon/lgf_writer.h>
using namespace lemon;
int main(int argc, const char *argv[]) {
SmartDigraph target;
SmartDigraph::ArcMap<int> tmap(target);
SmartGraph source;
SmartGraph::Node n1 = source.addNode();
SmartGraph::Node n2 = source.addNode();
SmartGraph::Edge e = source.addEdge(n1, n2);
SmartGraph::EdgeMap<int> map(source);
map[e] = 42;
digraphCopy(source, target).arcMap(map, tmap).run();
digraphWriter(target, std::cout).arcMap("map", tmap).run();
return 0;
}
I think, the order of source and destination graphs in the parameter list are
changed in 1.x versions. Because each undirected graph is at the same time
directed graph, therefore you can use digraphCopy().
Best regards, Balazs
On Tuesday 02 February 2010 21:02:24 Mitcsenkov Attila wrote:
> Hi,
>
> I would like to create a directed copy of an undirected graph.
> More detailed: I have a ListGraph instance, and based on that I want to
> create a directed graph, with two directed arcs instead of any undirected
> edge, with some edgemap values "duplicated", e.g. if length[e] was 5 in
> the undirected graph, I want to have two directed arcs, both with length
> 5.
>
> Once I was using Lemon 0.x, it was working by using graphcopy.
>
> Now I cannot solve the problem, since the GraphCopy and DigraphCopy needs
> two undirected or two directed graphs. I have tried to use the
> Orienter/Undirector adaptors, but with those I have the following error
> messages:
>
> 3>.\OptimalLP.cpp(52) : error C2664:
> 'lemon::DigraphCopy<From,To>::DigraphCopy(const From &,To &)' : cannot
> convert parameter 1 from 'lemon::Orienter<GR,DM>' to 'const
> lemon::ListDigraph &' 3> with
> 3> [
> 3> From=lemon::ListDigraph,
> 3> To=lemon::ListDigraph
> 3> ]
> 3> and
> 3> [
> 3> GR=const lemon::ListGraph,
> 3> DM=const
> lemon::GraphExtender<lemon::ListGraphBase>::EdgeMap<bool> 3> ]
> 3> Reason: cannot convert from 'lemon::Orienter<GR,DM>' to 'const
> lemon::ListDigraph' 3> with
> 3> [
> 3> GR=const lemon::ListGraph,
> 3> DM=const
> lemon::GraphExtender<lemon::ListGraphBase>::EdgeMap<bool> 3> ]
> 3> No user-defined-conversion operator available that can perform
> this conversion, or the operator cannot be called
>
> As far as I understand the concept of graph adaptors, it should be
> available to use instead of ListDigraph...
>
> Could you please help to solve this?
>
> Thanks:
> Attila Mitcsenkov
>
More information about the Lemon-user
mailing list