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

de.uni.freiburg.iig.telematik.jagal.visualization.flexible.WeightedGraphComponent Maven / Gradle / Ivy

Go to download

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.visualization.flexible;

import de.invation.code.toval.graphic.component.DisplayFrame;
import de.uni.freiburg.iig.telematik.jagal.graph.Vertex;
import de.uni.freiburg.iig.telematik.jagal.graph.weighted.WeightedEdge;
import de.uni.freiburg.iig.telematik.jagal.graph.weighted.WeightedGraph;

public class WeightedGraphComponent, T extends Object> extends AbstractWeightedGraphComponent, T> {

	private static final long serialVersionUID = 6935652350923822176L;

	public WeightedGraphComponent(G graph) throws Exception {
		super(graph);
	}

	@Override
	protected String getEdgeLabel(WeightedEdge> e) {
		return String.valueOf(e.getWeight());
	}

	@SuppressWarnings({ "rawtypes", "unchecked" })
	public static void main(String[] args) throws Exception {
		WeightedGraph g = new WeightedGraph();
		g.addVertex("v1");
		g.addVertex("v2");
		g.addVertex("v3");
		g.addEdge("v1", "v2");
		g.addEdge("v2", "v3");
		new DisplayFrame(new WeightedGraphComponent(g), true);
	}
}