# Construct

Edit on Github

For example, I want to have a network that looks like a square:

    var A = new Node();
    var B = new Node();
    var C = new Node();
    var D = new Node();

    // Create connections
    A.connect(B);
    A.connect(C);
    B.connect(D);
    C.connect(D);

    // Construct a network
    var network = architect.Construct([A, B, C, D]);

And voila, basically a square, but stretched out, right?

The `construct()` function looks for nodes that have no input connections, and labels them as an input node. The same for output nodes: it looks for nodes without an output connection (and gating connection), and labels them as an output node!

You can also create networks with groups! This speeds up the creation process and saves lines of code.

    // Initialise groups of nodes
    var A = new Group(4);
    var B = new Group(2);
    var C = new Group(6);

    // Create connections between the groups
    A.connect(B);
    A.connect(C);
    B.connect(C);

    // Construct a network
    var network = architect.Construct([A, B, C, D]);

Keep in mind that you must always specify your input groups/nodes in activation order. Input and output nodes will automatically get sorted out, but all hidden nodes will be activated in the order that they were given.