public static class GraphUtils.JGraphTUtils
extends Object
Auxiliary class to work with the graph library JGraphT.
Constructor and Description |
---|
GraphUtils.JGraphTUtils() |
Modifier and Type | Method and Description |
---|---|
static org.jgrapht.Graph<Integer,Integer> |
getAsWeightedGraph(org.jgrapht.Graph<Integer,Integer> graph,
double[] edgeWeightVector)
It generates a weighted view of the backing graph specified in the constructor.
|
static org.jgrapht.Graph<Integer,Integer> |
getDemandLayerGraph(NetPlan netPlan)
Returns a graph representing the traffic demands (nodes and links) of the network plan.
|
static org.jgrapht.Graph<Integer,Integer> |
getGraphFromLinkTable(int[][] linkTable,
int N)
Obtains a
JGraphT graph from a given link table. |
static org.jgrapht.Graph<Integer,Integer> |
getPhysicalLayerGraph(NetPlan netPlan)
Returns a graph representing the physical topology (nodes and links) of the network plan.
|
static boolean |
isBidirectional(org.jgrapht.Graph graph)
Check whether the topology has the same number of links between each node pair in both directions (assuming multi-digraphs).
|
static boolean |
isConnected(org.jgrapht.Graph graph)
Check whether the graph is connected, that is, if it is possible to connect every node to each other.
|
static boolean |
isConnected(org.jgrapht.Graph graph,
Set vertices)
Check whether the graph is connected, that is, if it is possible to connect every node to each other, but only in a subset of vertices (subgraph).
|
static boolean |
isSimple(org.jgrapht.Graph graph)
Check whether the graph is simple, that is, if it has at most one link between each node pair (one per direction under directed graphs, one under undirected graphs).
|
static boolean |
isWeightedBidirectional(org.jgrapht.Graph graph)
Check whether the graph has the same number of links between each node pair in both directions (assuming multi-digraphs) and same weights per direction.
|
public static org.jgrapht.Graph<Integer,Integer> getGraphFromLinkTable(int[][] linkTable, int N)
JGraphT
graph from a given link table.linkTable
- Set of installed links (first column: origin node, second column: destination node)N
- Number of nodesJGraphT
graphpublic static org.jgrapht.Graph<Integer,Integer> getAsWeightedGraph(org.jgrapht.Graph<Integer,Integer> graph, double[] edgeWeightVector)
It generates a weighted view of the backing graph specified in the constructor. This graph allows modules to apply algorithms designed for weighted graphs to an unweighted graph by providing an explicit edge weight mapping.
Query operations on this graph "read through" to the backing graph. Vertex addition/removal and edge addition/removal are supported.
graph
- The backing graph over which a weighted view is to be creatededgeWeightVector
- A mapping of edges to weightspublic static org.jgrapht.Graph<Integer,Integer> getDemandLayerGraph(NetPlan netPlan)
netPlan
- A network planpublic static org.jgrapht.Graph<Integer,Integer> getPhysicalLayerGraph(NetPlan netPlan)
netPlan
- A network planpublic static boolean isBidirectional(org.jgrapht.Graph graph)
graph
- The graph to analyzetrue
if the graph is bidirectional, and false otherwisepublic static boolean isWeightedBidirectional(org.jgrapht.Graph graph)
graph
- The graph to analyzetrue
if the graph is weighted-bidirectional, and false otherwisepublic static boolean isConnected(org.jgrapht.Graph graph)
graph
- The graph to analyzetrue
if the graph is connected, and false otherwisepublic static boolean isConnected(org.jgrapht.Graph graph, Set vertices)
graph
- The graph to analyzevertices
- Subset of verticestrue
if the subgraph is connected, and false otherwisepublic static boolean isSimple(org.jgrapht.Graph graph)
graph
- The graph to analyzetrue
if the graph is simple, and false otherwise