# Views¶

Views can modify the implementation of a network interface by

1. adding interface methods that are not supported by the implementation,

2. changing the implementation of interface methods, and

3. deleting interface methods.

Views implement the network interface and can be passed like a network to an algorithm. Several views are implemented in tweedledum.

## layers_view: Compute levels and depth¶

Header: tweedledum/views/layers_view.hpp

template<typename Network>
class layers_view : public tweedledum::immutable_view<Network>

Implements the network interface methods layer(node), layer(layer_index) and depth.

The layers are computed at construction and can be recomputed by calling the update method.

NOTE: The 0th and the last layers correspond to the input and output nodes, respectively.

## immutable_view: Prevent network changes¶

Header: tweedledum/views/immutable_view.hpp

template<typename Network>
class immutable_view : public Network

Deletes all methods that can change the network.

This view deletes all methods that can change the network structure such as This view is convenient to use as a base class for other views that make some computations based on the structure when being constructed.

Subclassed by tweedledum::layers_view< Network >, tweedledum::pathsum_view< Network >, tweedledum::stats_view< Network >

Public Functions

immutable_view(Network const &network)

Default constructor.

Constructs immutable view on a network.