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

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

Go to download

This project contains the apt processor that implements all the checks enumerated in @Verify. It is a self contained, and shaded jar.

There is a newer version: 2.0.7
Show newest version
/*
 * (C) Copyright 2007-2017, by Lucas J Scharenbroich 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 java.io.*;

import com.salesforce.jgrapht.*;

/**
 * An unweighted view of the backing weighted graph specified in the constructor. This graph allows
 * modules to apply algorithms designed for unweighted graphs to a weighted graph by simply ignoring
 * edge weights. Query operations on this graph "read through" to the backing graph. Vertex
 * addition/removal and edge addition/removal are all supported (and immediately reflected in the
 * backing graph).
 *
 * 

* Note that edges returned by this graph's accessors are really just the edges of the underlying * directed graph. *

* *

* This graph does not pass the hashCode and equals operations through to the backing graph, * but relies on Object's equals and hashCode methods. This graph will be * serializable if the backing graph is serializable. *

* * @param the graph vertex type * @param the graph edge type * * @author Lucas J. Scharenbroich * @since Sep 7, 2007 */ public class AsUnweightedGraph extends GraphDelegator implements Serializable { private static final long serialVersionUID = 7175505077601824663L; /** * Constructor for AsUnweightedGraph. * * @param g the backing graph over which an unweighted view is to be created. */ public AsUnweightedGraph(Graph g) { super(g); } /** * @see Graph#getEdgeWeight */ @Override public double getEdgeWeight(E e) { if (e == null) { throw new NullPointerException(); } else { return WeightedGraph.DEFAULT_EDGE_WEIGHT; } } } // End AsUnweightedGraph.java




© 2015 - 2025 Weber Informatics LLC | Privacy Policy