public int getIndex(NetworkGraph graph) {
        if (graph == null) {
            throw new IllegalArgumentException("The argument may not be null.");
        }

        if (!graph.getMasses().contains(this)) {
            throw new IllegalStateException("This mass is not in the given NetworkGraph.");
        }

        return graph.getMasses().indexOf(this);
    }