[Lemon-user] Question about copying graphs and maps

Dalia De Santis dalia.desantis at iit.it
Fri Jul 27 12:03:02 CEST 2012


Hi users,

I am very new to Lemon and I am a bit confused about graph copying.
I have to copy a graph and some related maps in a constructor of my class:

class network_map
    {
    public:
        ListDigraph g;
        ListDigraph::NodeMap<node_block>  nodes;
        ListDigraph::ArcMap<arc_block>    arches;

        network_map  (const ListDigraph & _g,
                              const ListDigraph::NodeMap<node_block>  & _nm,
                              const ListDigraph::ArcMap<arc_block> & _am)
                            : g(), nodes(_g), arches(_g)
        {
            DigraphCopy<ListDigraph,ListDigraph> dg_copy(_g,g);

            // create nodes and arches references: is it necessary?
            ListDigraph::NodeMap<node_block> nmap(g);
            ListDigraph::ArcMap<arc_block> amap(g);
            dg_copy.nodeRef(nmap);
            dg_copy.arcRef(amap);

            // copy maps:
            dg_copy.nodeMap(_nm,nodes);
            dg_copy.arcMap(_am, arches);

            dg_copy.run();
        };
   };

The maps of nodes and arches "nm" and "am" refers to the graph _g that I
want to copy. My class maps are created to refer to the class graph g that
will be a copy of the input graph _g, and they will be in turn a copy on n,
and am.
 I want to be sure that my new graph g contains all references to _g, as I
want to use it in my class as it were _g.

My questions are:
- Is it necessary to copy node references from a convenience map (nmap) of
the original graph if I am copying a map that already refers to the
original graph nodes?
- What does .nodeRef(map) exactly do?

I hope this is clear to you!
Thank you in advance,

-- 
*Dalia De Santis

MEng, Ph.D. Student*
*Istituto Italiano di Tecnologia
Robotics, Brain and Cognitive Sciences Dept.
Via Morego, 30, 16163 Genova*
dalia.desantis at iit.it
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lemon.cs.elte.hu/pipermail/lemon-user/attachments/20120727/d1335b8b/attachment.html>


More information about the Lemon-user mailing list