Solving Nonlinear Programs with Embedded Network Structures