  The problem of finding network codes for general connections is inherently
difficult in capacity constrained networks. Resource minimization for general
connections with network coding is further complicated. Existing methods for
identifying solutions mainly rely on highly restricted classes of network
codes, and are almost all centralized. In this paper, we introduce linear
network mixing coefficients for code constructions of general connections that
generalize random linear network coding (RLNC) for multicast connections. For
such code constructions, we pose the problem of cost minimization for the
subgraph involved in the coding solution and relate this minimization to a
path-based Constraint Satisfaction Problem (CSP) and an edge-based CSP. While
CSPs are NP-complete in general, we present a path-based probabilistic
distributed algorithm and an edge-based probabilistic distributed algorithm
with almost sure convergence in finite time by applying Communication Free
Learning (CFL). Our approach allows fairly general coding across flows,
guarantees no greater cost than routing, and shows a possible distributed
implementation. Numerical results illustrate the performance improvement of our
approach over existing methods.
