net_bn* CopyNet_bn ( const net_bn*  net,   const char*  new_name,   environ_ns*  new_env,   const char*  options )

Duplicates net, giving the new net the name new_name and placing it in the environment new_env. Returns the new net.

The name of the new net will be new_name. It must be a legal IDname, which means it must have NAME_MAX_ns (30) or fewer characters, all of which are letters, digits or underscores, and it must start with a letter. Netica will make a copy of new_name; it won't modify or free the passed string.

options allows you to control what gets copied. It can be any combination of the following strings, separated by commas: "no_nodes", "no_links", "no_tables", and "no_visual". Including "no_nodes" means that only background informatin (such as nodeset names/coloring, visual formatting, etc.) will be copied. Including "no_links" means that each node's links (and therefore tables) won't get duplicated. Including "no_tables" means that each node's tables (CPTs, functional, experience) won't get duplicated. Including "no_visual" means that visual information (such as node position, style) for the nodes or nets won't get duplicated.

The user fields of net and its nodes will be copied to the new net (see SetNetUserField_bn and SetNodeUserField_bn), but the user data of the new net and new nodes in that net will be set to NULL (see SetNetUserData_bn and SetNodeUserData_bn).

When you are done with the new net, you should pass it to DeleteNet_bn.

If you just wish to duplicate one or more nodes, see CopyNodes_bn. For other, more fine-grained control over the copying process, you may want to write your own duplicating function, in which case the NeticaEx function DuplicateNet may be a useful model.


In version 3.05 and later.
Versions 2.28 through 3.04 had a function called DuplicateNet_bn.
NeticaEx has a similar function called DuplicateNet.

See also:

CopyNodes_bn    Just duplicate some of the nodes in the net.


// This will duplicate net1's structure, but will not copy its CPT, functional,
// or experience tables.

net_bn* net2 = CopyNet_bn ( net1, "net2", env, "no_tables" );