public static NetworkGraph toNetworkGraph(String massesCsvContent, String connectionMapCsvContent) {
        if (massesCsvContent == null || connectionMapCsvContent == null) {
            throw new IllegalArgumentException("The arguments may not be null.");
        }

        NetworkGraph graph = new NetworkGraph();

        for (String massLine : massesCsvContent.split(NEWLINE)) {
            massLine = massLine.trim();

            if (massLine.isEmpty() || massLine.startsWith("#")) {
                continue;
            }

            String[] lineParts = massLine.split(SEPARATOR);

            if (lineParts.length < 4) {
                System.out.println("Warning: A line of the masses file could not be parsed. It is being skipped.");
                continue;
            }

            Mass.Type type = Mass.Type.getByCsvValue(lineParts[0]);
            double xCoordinate = Double.valueOf(lineParts[1]);
            double yCoordinate = Double.valueOf(lineParts[2]);

            graph.addMasses(new Mass(xCoordinate, yCoordinate, type));
        }

        for (String connectionLine : connectionMapCsvContent.split(NEWLINE)) {
            connectionLine = connectionLine.trim();

            if (connectionLine.isEmpty() || connectionLine.startsWith("#")) {
                continue;
            }

            String[] lineParts = connectionLine.split(SEPARATOR);

            if (lineParts.length < 2) {
                System.out.println("Warning: A line of the connction map file could not be parsed. It is being skipped.");
                continue;
            }

            int sourceMassIndex = Integer.valueOf(lineParts[0]);
            int destinationMassIndex = Integer.valueOf(lineParts[1]);

            Mass sourceMass = graph.getMasses().get(sourceMassIndex);
            Mass destinationMass = graph.getMasses().get(destinationMassIndex);

            graph.addSpring(sourceMass, destinationMass);
        }

        return graph;
    }