move networkAnalysis functions to own service and add test