Interoperability, flexibility, and adaptability are key requirements of future internet applications. Convergence of contents, services, things, and networks can be the cornerstone to fulfill these requirements. Such rich and composite sources of data and processing capabilities call for a structured and formal approach that manages and capitalizes heterogeneous information. This paper proposes an approach to the run-time composition of software system architectures, aimed at addressing goals revealed at runtime. The approach is grounded on a graph model characterized by two control levels: a metamodeling and an instantiation level. At metamodeling level, the graph describes facts that may occur in a scenario of interest, processes triggered by facts, and technologies available to execute processes. The actual occurrence of facts, together with the deriving processes and technologies, is managed at instantiation level, with reference to an application-specific model. In particular, the paper proposes an algorithm that determines an optimal way to manage a change in the run-time environment, by finding a minimum cost path in the model. The usefulness of the proposed approach and its applicability to actual scenarios have been validated in an example smart home environment.