All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.salesforce.jgrapht.generate.WeightedGraphGenerator Maven / Gradle / Ivy

/*
 * (C) Copyright 2016-2017, by Barak Naveh and Contributors.
 *
 * JGraphT : a free Java graph-theory library
 *
 * 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 com.salesforce.jgrapht.generate;

import com.salesforce.jgrapht.*;

/**
 * A base implementation of a weighted graph generator.
 * 
 * @param  the graph vertex type
 * @param  the graph edge type
 */
public abstract class WeightedGraphGenerator
    implements GraphGenerator
{
    protected Class edgeClass;
    protected EdgeFactory edgeFactory;
    protected double[][] weights;

    /**
     * Set the edge factory of the generator
     * 
     * @param edgeFactory the edge factory
     * @return the generator
     */
    public WeightedGraphGenerator edgeFactory(EdgeFactory edgeFactory)
    {
        this.edgeFactory = edgeFactory;
        return this;
    }

    /**
     * Set the edge class of the generator
     * 
     * @param edgeClass the edge class
     * @return the generator
     */
    public WeightedGraphGenerator edgeClass(Class edgeClass)
    {
        this.edgeClass = edgeClass;
        return this;
    }

    /**
     * Set the weights of the generator
     * 
     * @param weights of the generator
     * @return the generator
     */
    public WeightedGraphGenerator weights(double[][] weights)
    {
        this.weights = weights;
        return this;
    }
}

// End WeightedGraphGenerator.java




© 2015 - 2025 Weber Informatics LLC | Privacy Policy