Topological formulas for network functions