public void weightTheGraph(){
        // for each edge
        for (Edge e : this.factorgraph.getEdges()) {
            try {
                // weight this edge
                this.weightTheEdge(e);
            } catch (ParameterNotFoundException ex) {
                if (debug>=1) {
                        String dmethod = Thread.currentThread().getStackTrace()[2].getMethodName();
                        String dclass = Thread.currentThread().getStackTrace()[2].getClassName();
                        System.out.println("---------------------------------------");
                        System.out.println("[class: "+dclass+" method: " + dmethod+ "] " + "Failed to weight the edge: "+e);
                        System.out.println("---------------------------------------");
                }
            } catch (LengthMismatchException ex) {
                if (debug>=1) {
                        String dmethod = Thread.currentThread().getStackTrace()[2].getMethodName();
                        String dclass = Thread.currentThread().getStackTrace()[2].getClassName();
                        System.out.println("---------------------------------------");
                        System.out.println("[class: "+dclass+" method: " + dmethod+ "] " + "Failed to weight the edge: "+e);
                        System.out.println("---------------------------------------");
                }
            } catch (NullPointerException ex) {
                if (debug>=1) {
                        String dmethod = Thread.currentThread().getStackTrace()[2].getMethodName();
                        String dclass = Thread.currentThread().getStackTrace()[2].getClassName();
                        System.out.println("---------------------------------------");
                        System.out.println("[class: "+dclass+" method: " + dmethod+ "] " + "Failed to weight the edge: "+e);
                        System.out.println("---------------------------------------");
                }
            } catch (NodeTypeException ex) {
                if (debug>=1) {
                        String dmethod = Thread.currentThread().getStackTrace()[2].getMethodName();
                        String dclass = Thread.currentThread().getStackTrace()[2].getClassName();
                        System.out.println("---------------------------------------");
                        System.out.println("[class: "+dclass+" method: " + dmethod+ "] " + "Failed to weight the edge: "+e);
                        System.out.println("---------------------------------------");
                }
            }
        }
    }