Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^3: Efficient partial deep cloning

by exussum0 (Vicar)
on Jan 08, 2008 at 15:32 UTC ( #661107=note: print w/replies, xml ) Need Help??


in reply to Re^2: Efficient partial deep cloning
in thread Efficient partial deep cloning

Can't you use something like the reference of the current "thing" and the "thing" to be considered to be copied as a key in a hashset? Everytime you encounter those two things in that relationsip, process it once and only once?

Or.. create an algorithm to do a breadth first search (can be less memory intense) to discover all edges and copy them in a graph?

Replies are listed 'Best First'.
Re^4: Efficient partial deep cloning
by Ovid (Cardinal) on Jan 09, 2008 at 10:29 UTC

    In my current implementation, I use a %seen hash which tracks those references. Very easy to implement.

    Cheers,
    Ovid

    New address of my CGI Course.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://661107]
help
Chatterbox?
herveus waves to virtualsue
erix waves to Everybody
herveus waves back to erix

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (11)
As of 2017-09-26 14:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (296 votes). Check out past polls.

    Notices?