
de.uni.freiburg.iig.telematik.jagal.graph.weighted.AbstractWeightedGraph Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of JAGAL Show documentation
Show all versions of JAGAL Show documentation
JAGAL provides implementations for directed graphs (weighted and unweighted) and various types of transition systems as well as utils for graph traversal and modification.
The newest version!
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