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

de.uni.freiburg.iig.telematik.jagal.graph.weighted.AbstractWeightedGraph Maven / Gradle / Ivy

package de.uni.freiburg.iig.telematik.jagal.graph.weighted;


import java.util.Collection;

import de.invation.code.toval.validate.ParameterException;
import de.uni.freiburg.iig.telematik.jagal.graph.Vertex;
import de.uni.freiburg.iig.telematik.jagal.graph.abstr.AbstractGraph;
import de.uni.freiburg.iig.telematik.jagal.graph.exception.VertexNotFoundException;

public abstract class AbstractWeightedGraph, U> extends AbstractGraph, U>{
	
	public AbstractWeightedGraph(){
		super();
	}
	
	public AbstractWeightedGraph(String name) throws ParameterException{
		super(name);
	}
	
	public AbstractWeightedGraph(Collection vertexNames) throws ParameterException{
		super(vertexNames);
	}
	
	public AbstractWeightedGraph(String name, Collection vertexNames) throws ParameterException{
		super(name, vertexNames);
	}

//	@Override
//	protected String getEdgeClassName(){
//		return "graph.WeightedEdge";
//	}
	
//	public WeightedEdge addEdge(U sourceElement, U targetElement, double weight) throws VertexNotFoundException{
//		return addEdge(createNewVertex(sourceElement), createNewVertex(targetElement), weight);
//	}
	
	public WeightedEdge addEdge(String sourceVertexName, String targetVertexName, double weight) throws VertexNotFoundException, ParameterException{
		WeightedEdge newEdge = super.addEdge(sourceVertexName, targetVertexName);
		if(newEdge == null){
			//Edge already contained in graph
			return null;
		}
		newEdge.setWeight(weight);
		return newEdge;
	}

}






© 2015 - 2025 Weber Informatics LLC | Privacy Policy