         from = @getNode edge.from.node
         unless from
             throw new Error "No process defined for outbound node #{edge.from.node}"
+        unless from.component.isReady()
+            from.component.once "ready", =>
+                @addEdge edge
+            return
         to = @getNode edge.to.node
         unless to
             throw new Error "No process defined for inbound node #{edge.to.node}"
+        unless to.component.isReady()
+            to.component.once "ready", =>
+                @addEdge edge
+            return
 
         @connectPort socket, from, edge.from.port, false
         @connectPort socket, to, edge.to.port, true

        to = @getNode initializer.to.node
        unless to
            throw new Error "No process defined for inbound node #{initializer.to.node}"
        @connectPort socket, to, initializer.to.port, true
        @sendInitial socket, to.component, initializer.to.port, initializer.from.data
        @connections.push socket

    sendInitial: (socket, component, port, data) ->
        unless component.isReady() 
            unless component.inPorts[port] and component.inPorts[port].isAttached()
                component.once "ready", =>
                    @sendInitial socket, component, port, data
                return
        socket.connect()
        socket.send data
        socket.disconnect()

exports.createNetwork = (graph, debug = false) ->

                port: port

            unless process.component.inPorts and process.component.inPorts[port]
                throw new Error "No inport '#{port}' defined in process #{process.id}"
                return

            return process.component.inPorts[port].attach socket
