public class Operations
extends java.lang.Object
Constructor and Description |
---|
Operations() |
Modifier and Type | Method and Description |
---|---|
static <V,E> void |
addAllVertices(edu.uci.ics.jung.graph.Graph<V,E> G,
java.util.Set<V> A)
Add all the vertices of set A to the graph G.
|
static <V,E> V |
chooseRandVertex(edu.uci.ics.jung.graph.Graph<V,E> G)
Return a vertex of G choosen randomly.
|
static <V,E> edu.uci.ics.jung.graph.Graph<V,E> |
copyDirectedSparseGraph(edu.uci.ics.jung.graph.Graph<V,E> G)
Full copy (arcs + vertices) of the Graph.
|
static <V,E> edu.uci.ics.jung.graph.Graph<V,E> |
copyGraph(edu.uci.ics.jung.graph.Graph<V,E> G,
org.apache.commons.collections15.Factory<edu.uci.ics.jung.graph.Graph<V,E>> f)
Full copy (arcs + vertices) of a graph using the given factory.
|
static <V,E> edu.uci.ics.jung.graph.Graph<V,E> |
copyUndirectedSparseGraph(edu.uci.ics.jung.graph.Graph<V,E> G)
Full copy (edges + vertices) of the Graph.
|
static <V,E> java.util.Set<V> |
getAllDegVertex(edu.uci.ics.jung.graph.Graph<V,E> G,
int deg)
Retunrs the set of all the vertices of degree 'deg' for the graph G.
|
static <V,E> java.util.Set<V> |
getAllMaxDegVertex(edu.uci.ics.jung.graph.Graph<V,E> G)
Returns a set containing vertices of G with highest degree.
|
static <V,E> java.util.Set<V> |
getAllMinDegVertex(edu.uci.ics.jung.graph.Graph<V,E> G)
Returns a set containing vertices of G with lowest degree.
|
static <V,E> V |
getDegVertex(edu.uci.ics.jung.graph.Graph<V,E> G,
int deg)
Returns a vertex of degree 'deg' for the graph G.
|
static <V,E> double |
getDensity(edu.uci.ics.jung.graph.Graph<V,E> G)
Returns density of a graph G.
|
static <V,E> int |
getDiameter(edu.uci.ics.jung.graph.Graph<V,E> G)
Returns the diameter of a graph.
|
static <V,E> int |
getMaxDeg(edu.uci.ics.jung.graph.Graph<V,E> G)
Returns the maximum degree of G.
|
static <V,E> V |
getMaxDegVertex(edu.uci.ics.jung.graph.Graph<V,E> G)
Returns a vertex of G with maximum degree.
|
static <V,E> int |
getMinDeg(edu.uci.ics.jung.graph.Graph<V,E> G)
Returns the minimum degree of G.
|
static <V,E> V |
getMinDegVertex(edu.uci.ics.jung.graph.Graph<V,E> G)
Returns a vertex of G with minimum degree.
|
static <V,E> int |
getNbEdges(edu.uci.ics.jung.graph.Graph<V,E> G,
java.util.Set<V> A)
Returns the amount of edges which are linking vertices of A.
|
static <V,E> java.util.Set<V> |
getNeighbors(edu.uci.ics.jung.graph.Graph<V,E> G,
java.util.Set<V> S)
Returns all neighbors of S without S (usually denoted as N(S)).
|
static <V,E> java.util.Set<V> |
getNeighbors(edu.uci.ics.jung.graph.Graph<V,E> G,
V v,
int dist)
Returns the neighbors vertices of a set of v at a given distance.
|
static <V,E> boolean |
isAcyclic(edu.uci.ics.jung.graph.Graph<V,E> G)
Returns true if a directed graph has no circuit.
|
static <V,E> boolean |
isClique(edu.uci.ics.jung.graph.Graph<V,E> G,
java.util.Set<V> K)
Tests if a set of vertices is a clique for the Graph G.
|
static <V,E> boolean |
isCycle(edu.uci.ics.jung.graph.Graph<V,E> G,
java.util.Set<V> C)
Return true if the subset C of G contains at least one cycle.
|
static <V,E> boolean |
isEdge(edu.uci.ics.jung.graph.Graph<V,E> G,
V v1,
V v2)
Tests if an edge exists between vertices v1 and v2.
|
static <V,E> boolean |
isRegular(edu.uci.ics.jung.graph.Graph<V,E> G)
Tests if a graph is regular.
|
static <V,E> boolean |
isRegular(edu.uci.ics.jung.graph.Graph<V,E> G,
int deg)
Tests if a graph is d-regular.
|
static <V,E> void |
mergeGraph(edu.uci.ics.jung.graph.Graph<V,E> G,
edu.uci.ics.jung.graph.Graph<V,E> subG)
Merge graph subG into G.
|
static <V> void |
quickSortSet(java.util.ArrayList<java.util.Set<V>> tab,
int p,
int r)
Ascending sort of a list of sets of vertices following their cardinality.
|
static <V,E> void |
removeAllEdges(edu.uci.ics.jung.graph.Graph<V,E> G,
java.util.Set<E> R)
Remove all the edges of set R of the graph G.
|
static <V,E> void |
removeAllVertices(edu.uci.ics.jung.graph.Graph<V,E> G,
java.util.Set<V> R)
Remove all the vertices of set R of the graph G.
|
static <V,E> void |
rewireEdge(edu.uci.ics.jung.graph.Graph<V,E> G,
E edge,
org.apache.commons.collections15.Factory<E> edgeFactory)
Randomly rewire a given edge in a graph.
|
static <V,E> void |
rewireEdgesRand(edu.uci.ics.jung.graph.Graph<V,E> G,
int amount,
org.apache.commons.collections15.Factory<E> edgeFactory)
Randomly rewire edges in a graph.
|
static <V,E> void |
subGraph(edu.uci.ics.jung.graph.Graph<V,E> G,
edu.uci.ics.jung.graph.Graph<V,E> subG,
java.util.Set<V> S)
Insert into subG nodes and edges of N[S] in G.
|
static <V,E> void |
subGraph(edu.uci.ics.jung.graph.Graph<V,E> G,
edu.uci.ics.jung.graph.Graph<V,E> subG,
V x)
Insert into subG nodes and edges of N[x] in G.
|
public static <V,E> void subGraph(edu.uci.ics.jung.graph.Graph<V,E> G, edu.uci.ics.jung.graph.Graph<V,E> subG, V x)
G
- original graphsubG
- subgraph of Gx
- node to add with its neighborhood in Gtargetpublic static <V,E> void subGraph(edu.uci.ics.jung.graph.Graph<V,E> G, edu.uci.ics.jung.graph.Graph<V,E> subG, java.util.Set<V> S)
G
- original graphsubG
- subgraph of GS
- nodes to add with its neighborhoods in subGpublic static <V,E> void mergeGraph(edu.uci.ics.jung.graph.Graph<V,E> G, edu.uci.ics.jung.graph.Graph<V,E> subG)
G
- result graph of G ∪ subGsubG
- graph to merge into Gpublic static <V,E> edu.uci.ics.jung.graph.Graph<V,E> copyUndirectedSparseGraph(edu.uci.ics.jung.graph.Graph<V,E> G)
G
- Graph to copypublic static <V,E> edu.uci.ics.jung.graph.Graph<V,E> copyDirectedSparseGraph(edu.uci.ics.jung.graph.Graph<V,E> G)
G
- Graph to copypublic static <V,E> edu.uci.ics.jung.graph.Graph<V,E> copyGraph(edu.uci.ics.jung.graph.Graph<V,E> G, org.apache.commons.collections15.Factory<edu.uci.ics.jung.graph.Graph<V,E>> f)
V
- E
- G
- f
- public static <V,E> int getDiameter(edu.uci.ics.jung.graph.Graph<V,E> G)
G
- graphpublic static <V,E> V getMinDegVertex(edu.uci.ics.jung.graph.Graph<V,E> G)
G
- Graph in which vertex has to be foundpublic static <V,E> java.util.Set<V> getAllMinDegVertex(edu.uci.ics.jung.graph.Graph<V,E> G)
G
- Graph in which all vertices of min degree has to be foundpublic static <V,E> V getMaxDegVertex(edu.uci.ics.jung.graph.Graph<V,E> G)
G
- Graph in which vertex has to be foundpublic static <V,E> java.util.Set<V> getAllMaxDegVertex(edu.uci.ics.jung.graph.Graph<V,E> G)
G
- Graph in which all vertices of max degree has to be foundpublic static <V,E> int getMaxDeg(edu.uci.ics.jung.graph.Graph<V,E> G)
G
- Graph in which max degree has to be foundpublic static <V,E> int getMinDeg(edu.uci.ics.jung.graph.Graph<V,E> G)
G
- Graph in which min degree has to be foundpublic static <V,E> V getDegVertex(edu.uci.ics.jung.graph.Graph<V,E> G, int deg)
G
- graphdeg
- degreepublic static <V,E> java.util.Set<V> getAllDegVertex(edu.uci.ics.jung.graph.Graph<V,E> G, int deg)
G
- graphdeg
- degreepublic static <V,E> int getNbEdges(edu.uci.ics.jung.graph.Graph<V,E> G, java.util.Set<V> A)
G
- Graph where edges appearA
- Set containing vertices to testpublic static <V,E> java.util.Set<V> getNeighbors(edu.uci.ics.jung.graph.Graph<V,E> G, java.util.Set<V> S)
G
- graphS
- set of verticespublic static <V,E> java.util.Set<V> getNeighbors(edu.uci.ics.jung.graph.Graph<V,E> G, V v, int dist)
G
- Graphv
- vertexdist
- distance of the neighborspublic static <V,E> boolean isRegular(edu.uci.ics.jung.graph.Graph<V,E> G)
G
- graphpublic static <V,E> boolean isRegular(edu.uci.ics.jung.graph.Graph<V,E> G, int deg)
G
- graphdeg
- degreepublic static <V,E> boolean isAcyclic(edu.uci.ics.jung.graph.Graph<V,E> G)
G
- graphpublic static <V,E> boolean isCycle(edu.uci.ics.jung.graph.Graph<V,E> G, java.util.Set<V> C)
G
- graphC
- subset of Gpublic static <V,E> boolean isEdge(edu.uci.ics.jung.graph.Graph<V,E> G, V v1, V v2)
G
- Graph in which edge has to be foundv1
- 1st vertex of the edgev2
- 2nd vertex of the edgepublic static <V,E> boolean isClique(edu.uci.ics.jung.graph.Graph<V,E> G, java.util.Set<V> K)
G
- Graph where the set has to be tested.K
- Set of vertices to testpublic static <V,E> void addAllVertices(edu.uci.ics.jung.graph.Graph<V,E> G, java.util.Set<V> A)
G
- graphA
- set of vertices to add to Gpublic static <V,E> void removeAllVertices(edu.uci.ics.jung.graph.Graph<V,E> G, java.util.Set<V> R)
G
- graphR
- set of vertices to remove of Gpublic static <V,E> void removeAllEdges(edu.uci.ics.jung.graph.Graph<V,E> G, java.util.Set<E> R)
G
- graphR
- set of edges to remove of Gpublic static <V> void quickSortSet(java.util.ArrayList<java.util.Set<V>> tab, int p, int r)
tab
- list of setsp
- min boundaryr
- max boundarypublic static <V,E> V chooseRandVertex(edu.uci.ics.jung.graph.Graph<V,E> G)
G
- graphpublic static <V,E> double getDensity(edu.uci.ics.jung.graph.Graph<V,E> G)
G
- graphpublic static <V,E> void rewireEdgesRand(edu.uci.ics.jung.graph.Graph<V,E> G, int amount, org.apache.commons.collections15.Factory<E> edgeFactory)
G
- graphamount
- number of edges to rewire.edgeFactory
- factory used to create edge.public static <V,E> void rewireEdge(edu.uci.ics.jung.graph.Graph<V,E> G, E edge, org.apache.commons.collections15.Factory<E> edgeFactory)
G
- graphedge
- edge to rewire.edgeFactory
- factory used to create edge.