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

com.salesforce.jgrapht.graph.DirectedPseudograph Maven / Gradle / Ivy

/*
 * (C) Copyright 2004-2017, by Christian Hammer 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.graph;

import com.salesforce.jgrapht.*;
import com.salesforce.jgrapht.graph.builder.*;

/**
 * A directed pseudograph. A directed pseudograph is a non-simple directed graph in which both graph
 * loops and multiple edges are permitted. If you're unsure about pseudographs, see:
 * 
 * http://mathworld.wolfram.com/Pseudograph.html.
 * 
 * @param  the graph vertex type
 * @param  the graph edge type
 *
 */
public class DirectedPseudograph
    extends AbstractBaseGraph
    implements DirectedGraph
{
    private static final long serialVersionUID = -8300409752893486415L;

    /**
     * Creates a new directed pseudograph.
     *
     * @param edgeClass class on which to base factory for edges
     */
    public DirectedPseudograph(Class edgeClass)
    {
        this(new ClassBasedEdgeFactory<>(edgeClass));
    }

    /**
     * Creates a new directed pseudograph with the specified edge factory.
     *
     * @param ef the edge factory of the new graph.
     */
    public DirectedPseudograph(EdgeFactory ef)
    {
        super(ef, true, true);
    }

    /**
     * Create a builder for this kind of graph.
     * 
     * @param edgeClass class on which to base factory for edges
     * @param  the graph vertex type
     * @param  the graph edge type
     * @return a builder for this kind of graph
     */
    public static  DirectedGraphBuilderBase, ?> builder(
            Class edgeClass)
    {
        return new DirectedGraphBuilder<>(new DirectedPseudograph<>(edgeClass));
    }

    /**
     * Create a builder for this kind of graph.
     * 
     * @param ef the edge factory of the new graph
     * @param  the graph vertex type
     * @param  the graph edge type
     * @return a builder for this kind of graph
     */
    public static  DirectedGraphBuilderBase, ?> builder(
            EdgeFactory ef)
    {
        return new DirectedGraphBuilder<>(new DirectedPseudograph<>(ef));
    }
}

// End DirectedPseudograph.java




© 2015 - 2025 Weber Informatics LLC | Privacy Policy