Node source = nodeHelper.getNearestGraphNode(lineStringGen, networkGraph, originPoint, coordinateReferenceSystem);
//distance between the origin location and the nearest graph node
distanceOriginToGraph = nodeHelper.getDistanceFromGraphNode();
//weight the edges of the graph using the distance of each linestring
EdgeWeighter edgeWeighter = new EdgeWeighter() {
public double getWeight(org.geotools.graph.structure.Edge edge) {
SimpleFeature aLineString = (SimpleFeature) edge.getObject();
Geometry geom = (Geometry) aLineString.getDefaultGeometry();
return geom.getLength();
}