org.jgrapht.generate.WeightedGraphGeneratorAdapter Maven / Gradle / Ivy
/* This program and the accompanying materials are dual-licensed under
* either
*
* (a) the terms of the GNU Lesser General Public License version 2.1
* as published by the Free Software Foundation, or (at your option) any
* later version.
*
* or (per the licensee's choosing)
*
* (b) the terms of the Eclipse Public License v1.0 as published by
* the Eclipse Foundation.
*/
package org.jgrapht.generate;
import java.util.*;
import org.jgrapht.*;
/**
* WeightedGraphGenerator defines an interface for generating graph structures
* having edges weighted with real values.
*
* @author Alexey Kudinkin
* @since Aug 1, 2013
*/
public abstract class WeightedGraphGeneratorAdapter
implements GraphGenerator
{
protected double [][] weights;
///////////////////////////////////////////////////////////////////////////////////////////////
public abstract void generateGraph(
WeightedGraph target,
VertexFactory vertexFactory,
Map resultMap);
///////////////////////////////////////////////////////////////////////////////////////////////
public WeightedGraphGeneratorAdapter weights(double [][] weights)
{
this.weights = weights;
return this;
}
@Override public void generateGraph(
Graph target,
VertexFactory vertexFactory,
Map resultMap)
{
generateGraph((WeightedGraph) target, vertexFactory, resultMap);
}
}
// End WeightedGraphGeneratorAdapter.java