CreateNetwork {RNetica}R Documentation

Creates (destroys) a new Netica network.

Description

CreateNetwork() makes a new empty network in Netica, returning new NeticaBN objects. DeleteNetwork() frees the memory associated with the named network inside of Netica.

Usage

CreateNetwork(names, session=getDefaultSession())
DeleteNetwork(nets)

Arguments

names

A character vector giving the name or names of the network to be created.

session

An object of type NeticaSession which defines the reference to the Netica workspace.

nets

A list of NeticaBN objects to be destroyed.

Details

The CreateNetwork method creates a new network for each of the names. Names must follow the IDname rules. It returns a NeticaBN object, or a list of such objects if the argument names has length greater than 1.

The DeleteNetwork method frees the Netica memory associated with each net in its argument. Note that the network will not be available for use after it is deleted. It returns the NeticaBN objects, but modified so that they are no longer active.

The function is.active(), checks to see if the network associated with a NeticaBN object still corresponds to a network loaded into Netica's memory.

These functions wrap the Netica API functions NewNet_bn() and DeleteNet_bn().

Value

A single NeticaBN object if the length of the argument is 1, and a list of such objects if the argument has length greater than 1. For DeleteNets() if a specified network does not exist, the corresponding element in the return list will be NULL.

Implementation Note

In RNetica version 0.5 and later, the NeticaBN is used to store the refernce to the network. The enclosing NeticaSession object contains a table of network names to NeticaBN objects giving the pointer. It will signal an error if a network with the given name already exists and is active (not deleted).

In RNetica version 0.4 and prior, the NeticaBN object used the name of the networks to store the pointer into the network.

Note

The function DeleteNetwork() implicitly deletes any nodes associated with the network. Therefore, any nodes associated with this network will become inactive (see is.active()).

Author(s)

Russell Almond

References

http://norsys.com/onLineAPIManual/index.html: NewNet_bn(), DeleteNet_bn()

See Also

NeticaBN CopyNetworks(), is.active()

Examples

sess <- NeticaSession()
startSession(sess)

net1 <- CreateNetwork("EmptyNet", session=sess)
stopifnot(is(net1,"NeticaBN"))
stopifnot(net1$Name=="EmptyNet")
stopifnot(is.active(net1))

netd <- DeleteNetwork(net1)
stopifnot(!is.active(netd))
stopifnot(!is.active(net1))
stopifnot(netd$Name=="EmptyNet")

stopSession(sess)

[Package RNetica version 0.7-2 Index]