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 Longs, 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 TypeMethodDescriptionbooleanbooleanbooleanaddEdge(Long e, Collection<? extends Integer> y) booleanaddEdge(Long e, Collection<? extends Integer> y, edu.uci.ics.jung.graph.util.EdgeType arg2) booleanbooleancontainsEdge(Long e) booleanintfindEdgeSet(Integer x, Integer y) edu.uci.ics.jung.graph.util.EdgeTypeintintgetEdgeCount(edu.uci.ics.jung.graph.util.EdgeType x) getEdges()getEdges(edu.uci.ics.jung.graph.util.EdgeType x) edu.uci.ics.jung.graph.util.EdgeTypegetEdgeType(Long e) edu.uci.ics.jung.graph.util.Pair<Integer> getEndpoints(Long e) intintgetOpposite(Integer v, Long e) intintintintbooleanisArc(int x, int y) booleanbooleanisIncident(Integer x, Long e) booleanisNeighbor(Integer x, Integer y) booleanisPredecessor(Integer x, Integer y) booleanbooleanisSuccessor(Integer x, Integer y) static voidintbooleanremoveEdge(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- ifgraphhas more thanInteger.MAX_VALUEarcs (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:
removeEdgein interfaceedu.uci.ics.jung.graph.Hypergraph<Integer,Long> - Throws:
UnsupportedOperationException
-
removeVertex
- Specified by:
removeVertexin interfaceedu.uci.ics.jung.graph.Hypergraph<Integer,Long> - Throws:
UnsupportedOperationException
-
addEdge
- Specified by:
addEdgein interfaceedu.uci.ics.jung.graph.Graph<Integer,Long> - Throws:
UnsupportedOperationException
-
addEdge
- Specified by:
addEdgein interfaceedu.uci.ics.jung.graph.Graph<Integer,Long> - Throws:
UnsupportedOperationException
-
addEdge
- Specified by:
addEdgein 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:
addEdgein interfaceedu.uci.ics.jung.graph.Hypergraph<Integer,Long> - Throws:
UnsupportedOperationException
-
addVertex
- Specified by:
addVertexin interfaceedu.uci.ics.jung.graph.Hypergraph<Integer,Long> - Throws:
UnsupportedOperationException
-
main
- Throws:
IOExceptioncom.martiansoftware.jsap.JSAPException
-