public class JGraphTLib extends GraphLibrary<StdVertex,JGraphTWeightedEdge>
DEFAULTDIRECTED, DEFAULTFORCELOOPFREE, DEFAULTWEIGHTED, directed, graphCreated, SET_STATUS, weighted
Constructor and Description |
---|
JGraphTLib() |
Modifier and Type | Method and Description |
---|---|
void |
checkPrefaceGraph(boolean directed,
boolean weighted,
boolean forceLoopFree,
GraphLibrary<?,?> preface)
Checks whether or not this graph library would be able to create a graph
which is equivalent to the given graph.
|
static JGraphTLib |
createFromJGraphTGraph(org.jgrapht.Graph<?,?> graph)
Creates a JGraphTLib by copying the contents of the given JGraphT graph instance
|
JGraphTWeightedEdge |
derivAddEdge(StdVertex vertex1,
StdVertex vertex2)
Must create an edge and add it to the internal graph.
|
StdVertex |
derivAddVertex()
Must create a vertex and add it to the internal graph.
|
protected void |
derivCopyFromExistingGraph(java.lang.Object graph,
GraphLibrary<?,?> target)
Copies the contents of the given graph instance into the given graph
library.
|
protected void |
derivCreateGraph(boolean directed,
boolean weighted,
boolean forceLoopFree)
Must create the internal graph with the given COnfiguration.
|
protected double |
derivGetEdgeWeight(JGraphTWeightedEdge edge)
Returns the weight of the given edge.
|
StdVertex |
derivGetEndVertex(JGraphTWeightedEdge edge)
Returns the end point of the given edge.
|
StdVertex |
derivGetStartVertex(JGraphTWeightedEdge edge)
Returns the start point of the given edge.
|
protected void |
derivRemoveEdge(JGraphTWeightedEdge edge)
Removes the given edge from the internal graph
|
protected void |
derivRemoveVertex(StdVertex vertex)
Removes the given vertex from the internal graph.
|
protected void |
derivSetEdgeWeight(JGraphTWeightedEdge edge,
double weight)
Sets the given weight as the weight of the given edge.
|
void |
derivSetVertexIdent(StdVertex vertex,
java.lang.String ident)
Changes the identifier of the given vertex.
|
protected GraphConfiguration |
getDefaultGraphConfiguration()
Returns a GraphConfiguration which is working with the respective graph.
|
JGraphTWeightedEdge |
getEdge(StdVertex vertex1,
StdVertex vertex2)
Returns the edge which contains the given vertices.
|
int |
getEdgeCount() |
java.lang.Object |
getEdgeData(JGraphTWeightedEdge edge)
Returns the data of the given edge.
|
java.lang.Iterable<JGraphTWeightedEdge> |
getEdges() |
java.lang.Object |
getEdgeStatus(JGraphTWeightedEdge edge)
Returns the status of the given edge in O(1).
|
int |
getIngoingEdgeCount(StdVertex vertex)
Returns the amount of ingoing edges of the given vertex.
|
java.lang.Iterable<JGraphTWeightedEdge> |
getIngoingEdges(StdVertex vertex)
Returns all ingoing edges of the given vertex.
|
org.jgrapht.graph.AbstractBaseGraph<StdVertex,JGraphTWeightedEdge> |
getInternalGraph()
Returns the internal graph.
|
java.lang.String |
getLibName()
Returns the (constant) name of the graph library.
|
int |
getOutgoingEdgeCount(StdVertex vertex)
Returns the amount of outgoing edges of the given vertex.
|
java.lang.Iterable<JGraphTWeightedEdge> |
getOutgoingEdges(StdVertex vertex)
Returns all outgoing edges of the given vertex.
|
int |
getVertexCount() |
java.lang.Object |
getVertexData(StdVertex vertex)
Returns the data of the given vertex.
|
java.lang.String |
getVertexIdent(StdVertex vertex)
Returns the identifier of the given vertex.
|
java.lang.Object |
getVertexStatus(StdVertex vertex)
Returns the status of the given vertex in O(1).
|
java.lang.Iterable<StdVertex> |
getVertices() |
void |
setEdgeData(JGraphTWeightedEdge edge,
java.lang.Object data)
Sets the data of the given edge.
|
void |
setEdgeStatus(JGraphTWeightedEdge edge,
java.lang.Object status)
Sets the status of the given edge in O(1).
|
void |
setVertexData(StdVertex vertex,
java.lang.Object data)
Sets the data of the given vertex.
|
void |
setVertexStatus(StdVertex vertex,
java.lang.Object status)
Sets the status of the given vertex in O(1).
|
protected boolean |
supportsCopyFromExistingGraph()
Returns true, iff this GraphLibrary sub class supports creating graphs
from existing graph instances.
|
addEdge, addEdge, addEdge, addEdgeByIdent, addGraphListener, addVertex, addVertex, addVertex, addVertex, asConfigurated, clearAlgorithmResults, clearDates, clearEdgeData, clearEdgeDates, clearEdgeStates, clearEdgeStatus, clearGraph, clearStates, clearVertexData, clearVertexDates, clearVertexStates, clearVertexStatus, copyFromExistingGraph, copyFromExistingGraph, copyToGraph, copyToGraph, copyToGraph, createDefaultGraph, createGraph, createGraph, createGraph, createGraph, createGraphUnchecked, createGraphUnchecked, createMetaEdge, deleteLoops, deleteWarning, edgeExists, edgeExistsByIdent, edgesToString, edgeToString, enableLoops, forceLoopFree, getAlgorithmResult, getAverageDegree, getEdgeByIdent, getEdgeName, getEdgeWeight, getEdgeWeight, getEdgeWeightByIdent, getEndVertex, getEndVertex, getGraphId, getIncidentEdges, getMarkedEdgeCount, getMarkedVertexCount, getMaximumDegree, getMinimumDegree, getName, getNeighborCount, getNeighbors, getNextVertexIdentifier, getStartVertex, getUnmarkedNeighborCount, getVertexByIdent, getVertexByIdent, getVertexIdentUnchecked, getVertexStdPrefix, getVisualElements, graphModified, hasAlgorithmResult, hasEdgeData, hasVertexData, isDirected, isEdgeMarkedAsDeleted, isEdgeStatusSet, isEmpty, isForceLoopFree, isGraphCreated, isLoopFree, isVertexMarkedAsDeleted, isVertexStatusSet, isWeighted, markEdgeAsDeleted, markVertexAsDeleted, mergeGraph, metaEdgeToString, pollWarning, prepareAlgorithmRun, printWarning, putWarning, refresh, removeAlgorithmResult, removeEdge, removeEdge, removeEdge, removeEdgeDeletionMark, removeGraphListener, removeVertex, removeVertex, removeVertexDeletionMark, resolveVertexName, setAlgorithmResult, setBlockCacheOutput, setDirected, setEdgeDates, setEdgeStates, setEdgeWeight, setName, setVertexDates, setVertexIdent, setVertexStates, setVertexStatus, setVertexStdPrefix, toString, vertexExistsByIdent, vertexToString, verticesToString
public static JGraphTLib createFromJGraphTGraph(org.jgrapht.Graph<?,?> graph) throws InvalidGraphException
graph
- the graph to copy fromInvalidGraphException
- if the graph has unsupported propertiespublic JGraphTWeightedEdge derivAddEdge(StdVertex vertex1, StdVertex vertex2)
GraphLibrary
derivAddEdge
in class GraphLibrary<StdVertex,JGraphTWeightedEdge>
vertex1
- The first endpoint.vertex2
- The second endpoint.public StdVertex derivAddVertex()
GraphLibrary
derivAddVertex
in class GraphLibrary<StdVertex,JGraphTWeightedEdge>
protected void derivCreateGraph(boolean directed, boolean weighted, boolean forceLoopFree) throws InvalidGraphConfigException
GraphLibrary
derivCreateGraph
in class GraphLibrary<StdVertex,JGraphTWeightedEdge>
directed
- Determines, whether the graph shall be directed.weighted
- Determines, whether the graph shall be weighted.forceLoopFree
- Determines, whether it is impossible to add loops into the
graphInvalidGraphConfigException
- If the given configuration is notpublic void checkPrefaceGraph(boolean directed, boolean weighted, boolean forceLoopFree, GraphLibrary<?,?> preface) throws InvalidGraphConfigException
GraphLibrary
checkPrefaceGraph
in class GraphLibrary<StdVertex,JGraphTWeightedEdge>
preface
- the graph to check.InvalidGraphConfigException
- if this graph library is not able to create an equivalent
graph to the given graph.public int getVertexCount()
getVertexCount
in class GraphLibrary<StdVertex,JGraphTWeightedEdge>
public int getEdgeCount()
getEdgeCount
in class GraphLibrary<StdVertex,JGraphTWeightedEdge>
public java.lang.Iterable<JGraphTWeightedEdge> getEdges()
getEdges
in class GraphLibrary<StdVertex,JGraphTWeightedEdge>
public java.lang.String getLibName()
GraphLibrary
getLibName
in class GraphLibrary<StdVertex,JGraphTWeightedEdge>
public StdVertex derivGetStartVertex(JGraphTWeightedEdge edge)
GraphLibrary
derivGetStartVertex
in class GraphLibrary<StdVertex,JGraphTWeightedEdge>
public StdVertex derivGetEndVertex(JGraphTWeightedEdge edge)
GraphLibrary
derivGetEndVertex
in class GraphLibrary<StdVertex,JGraphTWeightedEdge>
public java.lang.Iterable<StdVertex> getVertices()
getVertices
in class GraphLibrary<StdVertex,JGraphTWeightedEdge>
public org.jgrapht.graph.AbstractBaseGraph<StdVertex,JGraphTWeightedEdge> getInternalGraph()
GraphLibrary
getInternalGraph
in class GraphLibrary<StdVertex,JGraphTWeightedEdge>
protected double derivGetEdgeWeight(JGraphTWeightedEdge edge)
GraphLibrary
derivGetEdgeWeight
in class GraphLibrary<StdVertex,JGraphTWeightedEdge>
protected void derivSetEdgeWeight(JGraphTWeightedEdge edge, double weight)
GraphLibrary
derivSetEdgeWeight
in class GraphLibrary<StdVertex,JGraphTWeightedEdge>
public java.lang.Iterable<JGraphTWeightedEdge> getIngoingEdges(StdVertex vertex)
GraphLibrary
getIngoingEdges
in class GraphLibrary<StdVertex,JGraphTWeightedEdge>
public int getIngoingEdgeCount(StdVertex vertex)
GraphLibrary
getIngoingEdgeCount
in class GraphLibrary<StdVertex,JGraphTWeightedEdge>
public java.lang.Iterable<JGraphTWeightedEdge> getOutgoingEdges(StdVertex vertex)
GraphLibrary
getOutgoingEdges
in class GraphLibrary<StdVertex,JGraphTWeightedEdge>
public int getOutgoingEdgeCount(StdVertex vertex)
GraphLibrary
getOutgoingEdgeCount
in class GraphLibrary<StdVertex,JGraphTWeightedEdge>
protected void derivRemoveVertex(StdVertex vertex)
GraphLibrary
derivRemoveVertex
in class GraphLibrary<StdVertex,JGraphTWeightedEdge>
vertex
- The vertex which shall be removedprotected void derivRemoveEdge(JGraphTWeightedEdge edge)
GraphLibrary
derivRemoveEdge
in class GraphLibrary<StdVertex,JGraphTWeightedEdge>
edge
- The edge which shall be removedpublic JGraphTWeightedEdge getEdge(StdVertex vertex1, StdVertex vertex2)
GraphLibrary
getEdge
in class GraphLibrary<StdVertex,JGraphTWeightedEdge>
vertex1
- The first vertex (start point if the graph is directed)vertex2
- The second vertex (end point if the graph is directed)public java.lang.String getVertexIdent(StdVertex vertex)
GraphLibrary
getVertexIdent
in class GraphLibrary<StdVertex,JGraphTWeightedEdge>
vertex
- The vertex its identifier shall be returnedpublic void derivSetVertexIdent(StdVertex vertex, java.lang.String ident)
GraphLibrary
derivSetVertexIdent
in class GraphLibrary<StdVertex,JGraphTWeightedEdge>
vertex
- The vertex its identifier shall be setident
- The new identifierpublic java.lang.Object getVertexStatus(StdVertex vertex)
GraphLibrary
getVertexStatus
in class GraphLibrary<StdVertex,JGraphTWeightedEdge>
vertex
- the vertex.public void setVertexStatus(StdVertex vertex, java.lang.Object status)
GraphLibrary
setVertexStatus
in class GraphLibrary<StdVertex,JGraphTWeightedEdge>
vertex
- the vertex of which the status shall be set.status
- the new status to set.public java.lang.Object getEdgeStatus(JGraphTWeightedEdge edge)
GraphLibrary
getEdgeStatus
in class GraphLibrary<StdVertex,JGraphTWeightedEdge>
edge
- the edge.public void setEdgeStatus(JGraphTWeightedEdge edge, java.lang.Object status)
GraphLibrary
setEdgeStatus
in class GraphLibrary<StdVertex,JGraphTWeightedEdge>
edge
- the edge of which the status shall be set.status
- the new status to set.public java.lang.Object getEdgeData(JGraphTWeightedEdge edge)
GraphLibrary
getEdgeData
in class GraphLibrary<StdVertex,JGraphTWeightedEdge>
edge
- the edge.public java.lang.Object getVertexData(StdVertex vertex)
GraphLibrary
getVertexData
in class GraphLibrary<StdVertex,JGraphTWeightedEdge>
vertex
- the vertex.public void setEdgeData(JGraphTWeightedEdge edge, java.lang.Object data)
GraphLibrary
setEdgeData
in class GraphLibrary<StdVertex,JGraphTWeightedEdge>
edge
- the edge of which the data shall be set.data
- the new data.public void setVertexData(StdVertex vertex, java.lang.Object data)
GraphLibrary
setVertexData
in class GraphLibrary<StdVertex,JGraphTWeightedEdge>
vertex
- the vertex of which thee status shall be set.data
- the new data to set.protected GraphConfiguration getDefaultGraphConfiguration()
GraphLibrary
getDefaultGraphConfiguration
in class GraphLibrary<StdVertex,JGraphTWeightedEdge>
protected void derivCopyFromExistingGraph(java.lang.Object graph, GraphLibrary<?,?> target) throws InvalidGraphException, InvalidGraphConfigException
GraphLibrary
derivCopyFromExistingGraph
in class GraphLibrary<StdVertex,JGraphTWeightedEdge>
graph
- the graph instance of the respective graph library.target
- the target GraphLibrary to copy to.InvalidGraphException
- if the given object is not a valid graph instance of the
graph library.InvalidGraphConfigException
- if the graph library can not handle the configuration of the
given graph instance.protected boolean supportsCopyFromExistingGraph()
GraphLibrary
supportsCopyFromExistingGraph
in class GraphLibrary<StdVertex,JGraphTWeightedEdge>