Package it.unimi.dsi.webgraph.jung
Class JungAdapter
java.lang.Object
it.unimi.dsi.webgraph.jung.JungAdapter
- All Implemented Interfaces:
edu.uci.ics.jung.graph.DirectedGraph<Integer,
,Long> edu.uci.ics.jung.graph.Graph<Integer,
,Long> edu.uci.ics.jung.graph.Hypergraph<Integer,
Long>
public class JungAdapter
extends Object
implements edu.uci.ics.jung.graph.DirectedGraph<Integer,Long>
An adapter exposing an
ImmutableGraph
as a Jung
DirectedGraph
.
Using this adapter it is easy to apply Jung's analysis and visualisation code to immutable graphs.
Edges are just Long
s, and their values are the index of the source node, shifted to the left by
32 bits, OR'd with the index of the target node.
The main method of this class provides a simple way to translate any immutable graph in Pajek format.
-
Constructor Summary
ConstructorsConstructorDescriptionJungAdapter
(ImmutableGraph graph, ImmutableGraph transpose) Creates a Jung adapter. -
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
boolean
addEdge
(Long e, Collection<? extends Integer> y) boolean
addEdge
(Long e, Collection<? extends Integer> y, edu.uci.ics.jung.graph.util.EdgeType arg2) boolean
boolean
containsEdge
(Long e) boolean
int
findEdgeSet
(Integer x, Integer y) edu.uci.ics.jung.graph.util.EdgeType
int
int
getEdgeCount
(edu.uci.ics.jung.graph.util.EdgeType x) getEdges()
getEdges
(edu.uci.ics.jung.graph.util.EdgeType x) edu.uci.ics.jung.graph.util.EdgeType
getEdgeType
(Long e) edu.uci.ics.jung.graph.util.Pair
<Integer> getEndpoints
(Long e) int
int
getOpposite
(Integer v, Long e) int
int
int
int
boolean
isArc
(int x, int y) boolean
boolean
isIncident
(Integer x, Long e) boolean
isNeighbor
(Integer x, Integer y) boolean
isPredecessor
(Integer x, Integer y) boolean
boolean
isSuccessor
(Integer x, Integer y) static void
int
boolean
removeEdge
(Long e) boolean
-
Constructor Details
-
JungAdapter
Creates a Jung adapter.- Parameters:
graph
- a graph.transpose
- its transpose (look atTransform.transpose(ImmutableGraph)
andTransform.transposeOffline(ImmutableGraph, int, java.io.File)
for ways to generate the transpose of a graph).- Throws:
IllegalArgumentException
- ifgraph
has more thanInteger.MAX_VALUE
arcs (asgetEdgeCount()
returns an integer).
-
-
Method Details
-
getSource
-
getDest
-
getEndpoints
-
getInEdges
-
getOpposite
-
getOutEdges
-
getPredecessorCount
-
getPredecessors
-
getSuccessorCount
-
getSuccessors
-
inDegree
-
isDest
-
isArc
public boolean isArc(int x, int y) -
isPredecessor
-
isSource
-
isSuccessor
-
outDegree
-
containsEdge
-
containsVertex
-
degree
-
findEdge
-
findEdgeSet
-
getDefaultEdgeType
public edu.uci.ics.jung.graph.util.EdgeType getDefaultEdgeType() -
getEdgeCount
public int getEdgeCount() -
getEdgeCount
public int getEdgeCount(edu.uci.ics.jung.graph.util.EdgeType x) -
getEdgeType
-
getEdges
-
getEdges
-
getIncidentCount
-
getIncidentEdges
-
getIncidentVertices
-
getNeighborCount
-
getNeighbors
-
getVertexCount
public int getVertexCount() -
getVertices
-
isIncident
-
isNeighbor
-
removeEdge
- Specified by:
removeEdge
in interfaceedu.uci.ics.jung.graph.Hypergraph<Integer,
Long> - Throws:
UnsupportedOperationException
-
removeVertex
- Specified by:
removeVertex
in interfaceedu.uci.ics.jung.graph.Hypergraph<Integer,
Long> - Throws:
UnsupportedOperationException
-
addEdge
- Specified by:
addEdge
in interfaceedu.uci.ics.jung.graph.Graph<Integer,
Long> - Throws:
UnsupportedOperationException
-
addEdge
- Specified by:
addEdge
in interfaceedu.uci.ics.jung.graph.Graph<Integer,
Long> - Throws:
UnsupportedOperationException
-
addEdge
- Specified by:
addEdge
in interfaceedu.uci.ics.jung.graph.Hypergraph<Integer,
Long> - Throws:
UnsupportedOperationException
-
addEdge
public boolean addEdge(Long e, Collection<? extends Integer> y, edu.uci.ics.jung.graph.util.EdgeType arg2) - Specified by:
addEdge
in interfaceedu.uci.ics.jung.graph.Hypergraph<Integer,
Long> - Throws:
UnsupportedOperationException
-
addVertex
- Specified by:
addVertex
in interfaceedu.uci.ics.jung.graph.Hypergraph<Integer,
Long> - Throws:
UnsupportedOperationException
-
main
- Throws:
IOException
com.martiansoftware.jsap.JSAPException
-