public class ComponentGroupMultiGraph
extends java.lang.Object
implements edu.uci.ics.jung.graph.Graph
Modifier and Type | Field and Description |
---|---|
protected edu.uci.ics.jung.graph.Graph |
delegate
The delegated graph
|
protected java.util.Map |
edge_elemets
The map of edge elements
|
protected org.apache.commons.collections15.Factory |
edge_factory
Factories for edges
|
protected jadex.tools.comanalyzer.graph.ComponentGroupMultiGraph.GenericSortedList |
edge_weights
The edge weights is the number of edge elements contained in the edge.
|
protected java.util.Map |
vertex_elemets
The map of vertex elements
|
protected org.apache.commons.collections15.Factory |
vertex_factory
Factoriy for vertices
|
protected jadex.tools.comanalyzer.graph.ComponentGroupMultiGraph.GenericSortedList |
vertex_weights
The vertex weights is the number of edges going in or out the vertex.
|
Modifier | Constructor and Description |
---|---|
protected |
ComponentGroupMultiGraph(org.apache.commons.collections15.Factory vertex_factory,
org.apache.commons.collections15.Factory edge_factory,
edu.uci.ics.jung.graph.Graph delegate)
The constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addEdge(java.lang.Object edge,
java.util.Collection vertices)
Adds an edge to the graph.
|
boolean |
addEdge(java.lang.Object edge,
java.util.Collection vertices,
edu.uci.ics.jung.graph.util.EdgeType edge_type)
Adds
edge to this graph with type edge_type . |
boolean |
addEdge(java.lang.Object e,
java.lang.Object v1,
java.lang.Object v2)
Adds an directed edge to the graph.
|
boolean |
addEdge(java.lang.Object e,
java.lang.Object v1,
java.lang.Object v2,
edu.uci.ics.jung.graph.util.EdgeType edgeType)
Adds an edge with a given edge type to the graph.
|
boolean |
addEdgeElement(java.lang.Object ee,
java.lang.Object ve1,
java.lang.Object ve2)
Adds an directed edge element with given vertex elements to the graph.
|
boolean |
addEdgeElement(java.lang.Object ee,
java.lang.Object ve1,
java.lang.Object ve2,
edu.uci.ics.jung.graph.util.EdgeType edgeType)
Adds an edge element with given vertex elements and edge type to the
graph.
|
boolean |
addVertex(java.lang.Object vertex)
Adds a vertex to the graph.
|
boolean |
addVertexElement(java.lang.Object ve)
Adds a new vertex containing the vertex element to the graph.
|
boolean |
appendEdgeElement(java.lang.Object ee,
java.lang.Object ve1,
java.lang.Object ve2)
Appends an directed edge element with given vertex elements to the graph.
|
boolean |
appendEdgeElement(java.lang.Object ee,
java.lang.Object ve1,
java.lang.Object ve2,
edu.uci.ics.jung.graph.util.EdgeType edgeType)
Appends an edge element with given vertex elements and edge type to the
graph.
|
boolean |
appendVertexElement(java.lang.Object ve,
java.lang.Object v)
Append a vertex element to a vertex.
|
void |
clear()
Clear all elements from the delegated graph and this graph.
|
boolean |
containsEdge(java.lang.Object edge)
Returns
true if the graph contains the edge. |
boolean |
containsEdgeElement(java.lang.Object ee)
Returns
true if the graph contains the given edge element. |
boolean |
containsVertex(java.lang.Object vertex)
Returns
true if the graph contains the vertex. |
boolean |
containsVertexElement(java.lang.Object ve)
Returns
true if the graph contains the given vertex
element. |
static ComponentGroupMultiGraph |
createInstance(org.apache.commons.collections15.Factory vertex_factory,
org.apache.commons.collections15.Factory edge_factory,
edu.uci.ics.jung.graph.Graph delegate)
Factory method for the graph.
|
int |
degree(java.lang.Object vertex)
Returns the degree (number of incident edges) of a vertex.
|
IComponentGroup |
findEdge(java.lang.Object ee)
Returns the edge (group) for an edge element.
|
java.lang.Object |
findEdge(java.lang.Object v1,
java.lang.Object v2)
Returns the first edge between the two vertices.
|
java.util.Collection |
findEdgeSet(java.lang.Object v1,
java.lang.Object v2)
Returns a collection of edges between the two vertices.
|
IComponentGroup |
findVertex(java.lang.Object ve)
Returns the vertex (group) for a vertex element.
|
java.util.Collection |
getAllEdgeElements()
Returns all edge elements.
|
java.util.Collection |
getAllVertexElements()
Returns all vertex elements.
|
edu.uci.ics.jung.graph.util.EdgeType |
getDefaultEdgeType() |
java.lang.Object |
getDest(java.lang.Object directed_edge)
Returns the destination of a directed edge.
|
int |
getEdgeCount() |
int |
getEdgeCount(edu.uci.ics.jung.graph.util.EdgeType et) |
java.util.Collection |
getEdges()
Returns all edges of the graph.
|
java.util.Collection |
getEdges(edu.uci.ics.jung.graph.util.EdgeType edgeType)
Returns the edges for a given edge type.
|
edu.uci.ics.jung.graph.util.EdgeType |
getEdgeType(java.lang.Object edge)
Returns the edge type of en edge.
|
edu.uci.ics.jung.graph.util.Pair |
getEndpoints(java.lang.Object edge)
Returns the endpoints of the edge.
|
int |
getHighestEdgeWeight()
Returns the highest edge weight
|
int |
getHighestVertexWeight()
Returns the highest vertex weight.
|
int |
getIncidentCount(java.lang.Object edge)
Returns 2 if the edge has two different endpoints.
|
java.util.Collection |
getIncidentEdges(java.lang.Object vertex)
Returns the incident edges of the vertex.
|
java.util.Collection |
getIncidentVertices(java.lang.Object edge) |
java.util.Collection |
getInEdges(java.lang.Object vertex)
Returns the incoming edges of the vertex.
|
int |
getNeighborCount(java.lang.Object vertex)
Returns the neighbor count.
|
java.util.Collection |
getNeighbors(java.lang.Object vertex)
Returns the neighbor vertices of a given vertex.
|
java.lang.Object |
getOpposite(java.lang.Object vertex,
java.lang.Object edge)
Returns the other endpoint of the edge.
|
java.util.Collection |
getOutEdges(java.lang.Object vertex)
Returns the outgoing edges of the vertex.
|
int |
getPredecessorCount(java.lang.Object vertex)
Returns the number of vertices that have an outgoing edge to the given vertex.
|
java.util.Collection |
getPredecessors(java.lang.Object vertex)
Returns the vertices that have an outgoing edge to the given vertex.
|
java.lang.Object |
getSource(java.lang.Object directed_edge)
Returns the source of a directed edge.
|
int |
getSuccessorCount(java.lang.Object vertex)
Returns the number of vertices that have an incoming edge from the given vertex.
|
java.util.Collection |
getSuccessors(java.lang.Object vertex)
Returns the vertices that have an incoming edge from the given vertex.
|
int |
getVertexCount() |
java.util.Collection |
getVertices()
Returns all vertices of the graph.
|
int |
inDegree(java.lang.Object vertex)
Returns the count of incoming edges to the vertex.
|
boolean |
isDest(java.lang.Object vertex,
java.lang.Object edge)
Returns
true if the vertex is the destination of the edge. |
boolean |
isIncident(java.lang.Object vertex,
java.lang.Object edge)
Returns
true if vertex and edge
are incident to each other. |
boolean |
isNeighbor(java.lang.Object v1,
java.lang.Object v2)
Returns
true if v1 and v2 share an incident edge. |
boolean |
isPredecessor(java.lang.Object v1,
java.lang.Object v2)
Returns
true if there is an edge from first vertex to the second vertex. |
boolean |
isSource(java.lang.Object vertex,
java.lang.Object edge)
Returns
true if the vertex is the source of the edge. |
boolean |
isSuccessor(java.lang.Object v1,
java.lang.Object v2)
Returns
true if there is an edge from second vertex to the first vertex. |
int |
outDegree(java.lang.Object vertex)
Returns the count of outgoing edges from the vertex.
|
boolean |
removeEdge(java.lang.Object edge)
Removes an edge.
|
boolean |
removeEdgeElement(java.lang.Object ee)
Removes an edge element from the graph.
|
boolean |
removeVertex(java.lang.Object vertex)
Removes a vertex.
|
boolean |
removeVertexElement(java.lang.Object ve)
Removes a vertex element from the graph.
|
java.lang.String |
toString()
Text representation for this graph
|
protected org.apache.commons.collections15.Factory vertex_factory
protected org.apache.commons.collections15.Factory edge_factory
protected java.util.Map edge_elemets
protected java.util.Map vertex_elemets
protected edu.uci.ics.jung.graph.Graph delegate
protected jadex.tools.comanalyzer.graph.ComponentGroupMultiGraph.GenericSortedList edge_weights
protected jadex.tools.comanalyzer.graph.ComponentGroupMultiGraph.GenericSortedList vertex_weights
protected ComponentGroupMultiGraph(org.apache.commons.collections15.Factory vertex_factory, org.apache.commons.collections15.Factory edge_factory, edu.uci.ics.jung.graph.Graph delegate)
vertex_factory
- The factory for vertices.edge_factory
- The factory for edges.delegate
- The delegated graph.public static ComponentGroupMultiGraph createInstance(org.apache.commons.collections15.Factory vertex_factory, org.apache.commons.collections15.Factory edge_factory, edu.uci.ics.jung.graph.Graph delegate)
vertex_factory
- The factory for vertices.edge_factory
- The factory for edges.delegate
- The delegated graph.public void clear()
public boolean addVertexElement(java.lang.Object ve)
ve
- The vertex element to add.true
if success.public boolean appendVertexElement(java.lang.Object ve, java.lang.Object v)
ve
- The vertex element to append.v
- The vertex the element is append to.true
if success.public boolean addEdgeElement(java.lang.Object ee, java.lang.Object ve1, java.lang.Object ve2, edu.uci.ics.jung.graph.util.EdgeType edgeType)
true
if success.public boolean addEdgeElement(java.lang.Object ee, java.lang.Object ve1, java.lang.Object ve2)
true
if success.public boolean appendEdgeElement(java.lang.Object ee, java.lang.Object ve1, java.lang.Object ve2)
true
if success.public boolean appendEdgeElement(java.lang.Object ee, java.lang.Object ve1, java.lang.Object ve2, edu.uci.ics.jung.graph.util.EdgeType edgeType)
true
if success.public IComponentGroup findEdge(java.lang.Object ee)
ee
- The edge element to find.public IComponentGroup findVertex(java.lang.Object ve)
ve
- The vertex element to findpublic boolean containsEdgeElement(java.lang.Object ee)
true
if the graph contains the given edge element.ee
- The edge element to querytrue
if presentpublic boolean containsVertexElement(java.lang.Object ve)
true
if the graph contains the given vertex
element.ve
- The vertex element to querytrue
if successpublic boolean removeEdgeElement(java.lang.Object ee)
ee
- The edge element to removetrue
if success.public boolean removeVertexElement(java.lang.Object ve)
ve
- The vertex element to removetrue
if successpublic java.util.Collection getAllEdgeElements()
public java.util.Collection getAllVertexElements()
public int getHighestEdgeWeight()
public int getHighestVertexWeight()
public boolean addEdge(java.lang.Object edge, java.util.Collection vertices)
addEdge
in interface edu.uci.ics.jung.graph.Hypergraph
edge
- The edge.vertices
- A collection of veritexes. The size of the Collection
must be 2.true
if success.public boolean addEdge(java.lang.Object e, java.lang.Object v1, java.lang.Object v2, edu.uci.ics.jung.graph.util.EdgeType edgeType)
addEdge
in interface edu.uci.ics.jung.graph.Graph
e
- The edge.v1
- The first vertex.v2
- The second vertex.edgeType
- The edge type.true
if success.public boolean addEdge(java.lang.Object edge, java.util.Collection vertices, edu.uci.ics.jung.graph.util.EdgeType edge_type)
edge
to this graph with type edge_type
.
Fails under the following circumstances:
edge
is already an element of the graph
either edge
or vertices
is null
vertices
has the wrong number of vertices for the graph type
vertices
are already connected by another edge in this graph,
and this graph does not accept parallel edges
edge_type
is not legal for this graph
addEdge
in interface edu.uci.ics.jung.graph.Hypergraph
edge
- vertices
- true
if the add is successful, and false
otherwisejava.lang.IllegalArgumentException
- if edge
or vertices
is null,
or if a different vertex set in this graph is already connected by edge
,
or if vertices
are not a legal vertex set for edge
public boolean addEdge(java.lang.Object e, java.lang.Object v1, java.lang.Object v2)
addEdge
in interface edu.uci.ics.jung.graph.Graph
e
- The edge.v1
- The first vertex.v2
- The second vertex.true
if success.public boolean addVertex(java.lang.Object vertex)
addVertex
in interface edu.uci.ics.jung.graph.Hypergraph
vertex
- The vertex.true
if success.public boolean removeEdge(java.lang.Object edge)
removeEdge
in interface edu.uci.ics.jung.graph.Hypergraph
edge
- The edge to remove.true
if success.public boolean removeVertex(java.lang.Object vertex)
removeVertex
in interface edu.uci.ics.jung.graph.Hypergraph
vertex
- The vertex.true
if success.public boolean isIncident(java.lang.Object vertex, java.lang.Object edge)
true
if vertex
and edge
are incident to each other.
Equivalent to getIncidentEdges(vertex).contains(edge)
and to
getIncidentVertices(edge).contains(vertex)
.isIncident
in interface edu.uci.ics.jung.graph.Hypergraph
vertex
- edge
- true
if vertex
and edge
are incident to each otherpublic boolean isNeighbor(java.lang.Object v1, java.lang.Object v2)
true
if v1
and v2
share an incident edge.
Equivalent to getNeighbors(v1).contains(v2)
.isNeighbor
in interface edu.uci.ics.jung.graph.Hypergraph
v1
- the first vertex to testv2
- the second vertex to testtrue
if v1
and v2
share an incident edgepublic boolean containsEdge(java.lang.Object edge)
true
if the graph contains the edge.containsEdge
in interface edu.uci.ics.jung.graph.Hypergraph
edge
- The edge.true
if the edge is in the graph.public boolean containsVertex(java.lang.Object vertex)
true
if the graph contains the vertex.containsVertex
in interface edu.uci.ics.jung.graph.Hypergraph
vertex
- The vertex.true
if the vertex is in the graph.public int degree(java.lang.Object vertex)
degree
in interface edu.uci.ics.jung.graph.Hypergraph
vertex
- The vertex.public java.lang.Object findEdge(java.lang.Object v1, java.lang.Object v2)
findEdge
in interface edu.uci.ics.jung.graph.Hypergraph
v1
- The first vertex.v2
- The second vertex.null
if there is no incident edge
between the vertices.public java.util.Collection findEdgeSet(java.lang.Object v1, java.lang.Object v2)
findEdgeSet
in interface edu.uci.ics.jung.graph.Hypergraph
v1
- The first vertex.v2
- The second vertex.null
if there is no
incident edge between the vertices.public java.lang.Object getDest(java.lang.Object directed_edge)
getDest
in interface edu.uci.ics.jung.graph.Graph
getDest
in interface edu.uci.ics.jung.graph.Hypergraph
directed_edge
- The edge.public int getEdgeCount()
getEdgeCount
in interface edu.uci.ics.jung.graph.Hypergraph
public int getEdgeCount(edu.uci.ics.jung.graph.util.EdgeType et)
getEdgeCount
in interface edu.uci.ics.jung.graph.Hypergraph
public java.util.Collection getEdges()
getEdges
in interface edu.uci.ics.jung.graph.Hypergraph
public java.util.Collection getEdges(edu.uci.ics.jung.graph.util.EdgeType edgeType)
getEdges
in interface edu.uci.ics.jung.graph.Hypergraph
edgeType
- The edge tzpe.public edu.uci.ics.jung.graph.util.EdgeType getEdgeType(java.lang.Object edge)
getEdgeType
in interface edu.uci.ics.jung.graph.Hypergraph
edge
- The edge.public edu.uci.ics.jung.graph.util.Pair getEndpoints(java.lang.Object edge)
getEndpoints
in interface edu.uci.ics.jung.graph.Graph
edge
- The edge.public int getIncidentCount(java.lang.Object edge)
getIncidentCount
in interface edu.uci.ics.jung.graph.Hypergraph
edge
- The edge.public java.util.Collection getIncidentEdges(java.lang.Object vertex)
getIncidentEdges
in interface edu.uci.ics.jung.graph.Hypergraph
vertex
- The vertex.public java.util.Collection getIncidentVertices(java.lang.Object edge)
getIncidentVertices
in interface edu.uci.ics.jung.graph.Hypergraph
public java.util.Collection getInEdges(java.lang.Object vertex)
getInEdges
in interface edu.uci.ics.jung.graph.Graph
getInEdges
in interface edu.uci.ics.jung.graph.Hypergraph
vertex
- The vertxpublic int getNeighborCount(java.lang.Object vertex)
getNeighborCount
in interface edu.uci.ics.jung.graph.Hypergraph
vertex
- The vertex.public java.util.Collection getNeighbors(java.lang.Object vertex)
getNeighbors
in interface edu.uci.ics.jung.graph.Hypergraph
vertex
- The vertex.public java.lang.Object getOpposite(java.lang.Object vertex, java.lang.Object edge)
getOpposite
in interface edu.uci.ics.jung.graph.Graph
vertex
- The vertex.edge
- The edge.public java.util.Collection getOutEdges(java.lang.Object vertex)
getOutEdges
in interface edu.uci.ics.jung.graph.Graph
getOutEdges
in interface edu.uci.ics.jung.graph.Hypergraph
vertex
- The vertxpublic int getPredecessorCount(java.lang.Object vertex)
getPredecessorCount
in interface edu.uci.ics.jung.graph.Graph
vertex
- The vertex.public java.util.Collection getPredecessors(java.lang.Object vertex)
getPredecessors
in interface edu.uci.ics.jung.graph.Graph
getPredecessors
in interface edu.uci.ics.jung.graph.Hypergraph
vertex
- The vertex.public java.lang.Object getSource(java.lang.Object directed_edge)
getSource
in interface edu.uci.ics.jung.graph.Graph
getSource
in interface edu.uci.ics.jung.graph.Hypergraph
directed_edge
- The edge.public int getSuccessorCount(java.lang.Object vertex)
getSuccessorCount
in interface edu.uci.ics.jung.graph.Graph
vertex
- The vertex.public java.util.Collection getSuccessors(java.lang.Object vertex)
getSuccessors
in interface edu.uci.ics.jung.graph.Graph
getSuccessors
in interface edu.uci.ics.jung.graph.Hypergraph
vertex
- The vertex.public int getVertexCount()
getVertexCount
in interface edu.uci.ics.jung.graph.Hypergraph
public java.util.Collection getVertices()
getVertices
in interface edu.uci.ics.jung.graph.Hypergraph
public int inDegree(java.lang.Object vertex)
inDegree
in interface edu.uci.ics.jung.graph.Graph
inDegree
in interface edu.uci.ics.jung.graph.Hypergraph
vertex
- The vertex.public boolean isDest(java.lang.Object vertex, java.lang.Object edge)
true
if the vertex is the destination of the edge.isDest
in interface edu.uci.ics.jung.graph.Graph
vertex
- The vertex.edge
- The edge.true
if the vertex is the destination.public boolean isPredecessor(java.lang.Object v1, java.lang.Object v2)
true
if there is an edge from first vertex to the second vertex.isPredecessor
in interface edu.uci.ics.jung.graph.Graph
v1
- The first vertex.v2
- The second vertex.true
if the first vertex is predecessor of the second vertex.public boolean isSource(java.lang.Object vertex, java.lang.Object edge)
true
if the vertex is the source of the edge.isSource
in interface edu.uci.ics.jung.graph.Graph
vertex
- The vertex.edge
- The edge.true
if the vertex is the source.public boolean isSuccessor(java.lang.Object v1, java.lang.Object v2)
true
if there is an edge from second vertex to the first vertex.isSuccessor
in interface edu.uci.ics.jung.graph.Graph
v1
- The first vertex.v2
- The second vertex.true
if the second vertex is successor of the fist vertex.public int outDegree(java.lang.Object vertex)
outDegree
in interface edu.uci.ics.jung.graph.Graph
outDegree
in interface edu.uci.ics.jung.graph.Hypergraph
vertex
- The vertex.public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
public edu.uci.ics.jung.graph.util.EdgeType getDefaultEdgeType()
getDefaultEdgeType
in interface edu.uci.ics.jung.graph.Hypergraph