@Test public void testNormalizeWeight() { CyEdge edge = mock(CyEdge.class); CyRow row = mock(CyRow.class); LayoutEdge layoutEdge = new LayoutEdge(edge, row); assertTrue(ew.normalizeWeight(layoutEdge)); }
public boolean normalizeWeight(LayoutEdge edge) { if (minWeight == maxWeight) return true; if (logOverflow) { maxLogWeight = maxLogWeight+5; logOverflow = false; } if ((edge.getWeight() <= minWeightCutoff) || (edge.getWeight() > maxWeightCutoff)) return false; double weight = 0; switch (this.type) { case GUESS: if (Math.abs(maxLogWeight-minLogWeight) > 3) { weight = edge.getLogWeight(); if (weight == logWeightCeiling) weight = maxLogWeight; weight = logNormalize(weight); } else { weight = normalize(edge.getWeight()); } break; case LOG: weight = edge.getLogWeight(); if (weight == logWeightCeiling) weight = maxLogWeight; weight = logNormalize(weight); break; case DISTANCE: weight = edge.getWeight(); weight = (lowerBounds + upperBounds) - normalize(weight); break; case WEIGHT: weight = normalize(edge.getWeight()); break; } edge.setWeight(weight); return true; }
EdgeWeighter { public boolean normalizeWeight(LayoutEdge edge) { if (minWeight == maxWeight) return true; if (logOverflow) { maxLogWeight = maxLogWeight+5; logOverflow = false; } if ((edge.getWeight() <= minWeightCutoff) || (edge.getWeight() > maxWeightCutoff)) return false; double weight = 0; switch (this.type) { case GUESS: if (Math.abs(maxLogWeight-minLogWeight) > 3) { weight = edge.getLogWeight(); if (weight == logWeightCeiling) weight = maxLogWeight; weight = logNormalize(weight); } else { weight = normalize(edge.getWeight()); } break; case LOG: weight = edge.getLogWeight(); if (weight == logWeightCeiling) weight = maxLogWeight; weight = logNormalize(weight); break; case DISTANCE: weight = edge.getWeight(); weight = (lowerBounds + upperBounds) - normalize(weight); break; case WEIGHT: weight = normalize(edge.getWeight()); break; } edge.setWeight(weight); return true; } }
EdgeWeighter { public boolean normalizeWeight(LayoutEdge edge) { if (minWeight == maxWeight) return true; if (logOverflow) { maxLogWeight = maxLogWeight+5; logOverflow = false; } if ((edge.getWeight() <= minWeightCutoff) || (edge.getWeight() > maxWeightCutoff)) return false; double weight = 0; switch (this.type) { case GUESS: if (Math.abs(maxLogWeight-minLogWeight) > 3) { weight = edge.getLogWeight(); if (weight == logWeightCeiling) weight = maxLogWeight; weight = logNormalize(weight); } else { weight = normalize(edge.getWeight()); } break; case LOG: weight = edge.getLogWeight(); if (weight == logWeightCeiling) weight = maxLogWeight; weight = logNormalize(weight); break; case DISTANCE: weight = edge.getWeight(); weight = (lowerBounds + upperBounds) - normalize(weight); break; case WEIGHT: weight = normalize(edge.getWeight()); break; } edge.setWeight(weight); return true; }  }
EdgeWeighter { public boolean normalizeWeight(LayoutEdge edge) { if (minWeight == maxWeight) return true; if (logOverflow) { maxLogWeight = maxLogWeight+5; logOverflow = false; } if ((edge.getWeight() <= minWeightCutoff) || (edge.getWeight() > maxWeightCutoff)) return false; double weight = 0; switch (this.type) { case GUESS: if (Math.abs(maxLogWeight-minLogWeight) > 3) { weight = edge.getLogWeight(); if (weight == logWeightCeiling) weight = maxLogWeight; weight = logNormalize(weight); } else { weight = normalize(edge.getWeight()); } break; case LOG: weight = edge.getLogWeight(); if (weight == logWeightCeiling) weight = maxLogWeight; weight = logNormalize(weight); break; case DISTANCE: weight = edge.getWeight(); weight = (lowerBounds + upperBounds) - normalize(weight); break; case WEIGHT: weight = normalize(edge.getWeight()); break; } edge.setWeight(weight); return true; }  @Tunable(description="How to interpret weight values:", groups={"Edge Weight Settings"}, gravity=2.0, context="both", longDescription="How to interpret weight values; must be one of ```Heuristic```, ```-Log(value)```, ```1 - normalized value``` and ```normalized value```. Defaults to ```Heuristic```", exampleStringValue="Heuristic") ListSingleSelection<WeightTypes> getType(); void setType(ListSingleSelection<WeightTypes> t); void setWeightAttribute(String weightAttribute); void reset(); void setWeightType(WeightTypes type); void setNormalizedBounds(double lowerBound, double upperBound); void setWeight(LayoutEdge layoutEdge); boolean normalizeWeight(LayoutEdge edge); void setMaxWeightCutoff(double maxWeight); void setMinWeightCutoff(double minWeight); }
EdgeWeighter { public boolean normalizeWeight(LayoutEdge edge) { if (minWeight == maxWeight) return true; if (logOverflow) { maxLogWeight = maxLogWeight+5; logOverflow = false; } if ((edge.getWeight() <= minWeightCutoff) || (edge.getWeight() > maxWeightCutoff)) return false; double weight = 0; switch (this.type) { case GUESS: if (Math.abs(maxLogWeight-minLogWeight) > 3) { weight = edge.getLogWeight(); if (weight == logWeightCeiling) weight = maxLogWeight; weight = logNormalize(weight); } else { weight = normalize(edge.getWeight()); } break; case LOG: weight = edge.getLogWeight(); if (weight == logWeightCeiling) weight = maxLogWeight; weight = logNormalize(weight); break; case DISTANCE: weight = edge.getWeight(); weight = (lowerBounds + upperBounds) - normalize(weight); break; case WEIGHT: weight = normalize(edge.getWeight()); break; } edge.setWeight(weight); return true; }  @Tunable(description="How to interpret weight values:", groups={"Edge Weight Settings"}, gravity=2.0, context="both", longDescription="How to interpret weight values; must be one of ```Heuristic```, ```-Log(value)```, ```1 - normalized value``` and ```normalized value```. Defaults to ```Heuristic```", exampleStringValue="Heuristic") ListSingleSelection<WeightTypes> getType(); void setType(ListSingleSelection<WeightTypes> t); void setWeightAttribute(String weightAttribute); void reset(); void setWeightType(WeightTypes type); void setNormalizedBounds(double lowerBound, double upperBound); void setWeight(LayoutEdge layoutEdge); boolean normalizeWeight(LayoutEdge edge); void setMaxWeightCutoff(double maxWeight); void setMinWeightCutoff(double minWeight); public WeightTypes type; @Tunable(description="The minimum edge weight to consider:", groups={"Edge Weight Settings"}, context="both", longDescription="The minimum edge weight to consider, numeric values, default is 0", exampleStringValue="0")
	public double minWeightCutoff; @Tunable(description="The maximum edge weight to consider:", groups={"Edge Weight Settings"}, context="both", longDescription="The maximum edge weight to consider, default to the Double.MAX value", exampleStringValue="1000")
	public double maxWeightCutoff; @Tunable(description="The default edge weight to consider:", groups={"Edge Weight Settings"}, context="both", longDescription="The default edge weight to consider, default is 0.5 ", exampleStringValue="0.5")
	public double defaultEdgeWeight; }