Package jadex.tools.comanalyzer.graph
Class MultidirectedMultiGraph
- java.lang.Object
-
- edu.uci.ics.jung.graph.AbstractGraph<V,E>
-
- edu.uci.ics.jung.graph.SparseGraph
-
- jadex.tools.comanalyzer.graph.MultidirectedMultiGraph
-
- All Implemented Interfaces:
edu.uci.ics.jung.graph.Graph,edu.uci.ics.jung.graph.Hypergraph,java.io.Serializable
public class MultidirectedMultiGraph extends edu.uci.ics.jung.graph.SparseGraph implements edu.uci.ics.jung.graph.Graph, java.io.SerializableImplementation of an Graph that can be used as a simple or a multi graph with directed and undirected edges.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected static intINCIDENTIndicates incident (undirected) edges in the mapprotected static intINCOMINGIndicates incoming edges in the mapprotected java.util.Mapmdirected_edgesMap of directed edges to incident vertex setsprotected java.util.Mapmundirected_edgesMap of undirected edges to incident vertex setsprotected java.util.Mapmvertex_mapsMap of vertices to adjacency maps of vertices to {incoming, outgoing, incident} edgesprotected static intOUTGOINGIndicates outgoing edges in the map
-
Constructor Summary
Constructors Constructor Description MultidirectedMultiGraph()Creates a new graph.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddEdge(java.lang.Object edge, edu.uci.ics.jung.graph.util.Pair endpoints)Adds a directed edge to the graph.booleanaddEdge(java.lang.Object edge, edu.uci.ics.jung.graph.util.Pair endpoints, edu.uci.ics.jung.graph.util.EdgeType edgeType)Adds a edge to the graph with a specific edge type.booleanaddEdge(java.lang.Object e, java.lang.Object v1, java.lang.Object v2)Adds a directed edge to the graph.booleanaddEdge(java.lang.Object e, java.lang.Object v1, java.lang.Object v2, edu.uci.ics.jung.graph.util.EdgeType edgeType)Adds a edge to the graph with a specific edge type.booleanaddVertex(java.lang.Object vertex)Adds a vertex to the graph.booleancontainsEdge(java.lang.Object edge)Returnstrueif the graph contains the edge.booleancontainsVertex(java.lang.Object vertex)Returnstrueif the graph contains the vertex.static edu.uci.ics.jung.graph.Graphcreate()Returns a new MultidirectedMultiGraph.intdegree(java.lang.Object vertex)Returns the degree (number of incident edges) of a vertex.java.lang.ObjectfindEdge(java.lang.Object v1, java.lang.Object v2)Returns the first edge between the two vertices.java.util.CollectionfindEdgeSet(java.lang.Object v1, java.lang.Object v2)Returns a collection of edges between the two vertices.java.lang.ObjectgetDest(java.lang.Object directed_edge)Returns the destination of a directed edge.intgetEdgeCount()java.util.CollectiongetEdges()Returns all edges of the graph.java.util.CollectiongetEdges(edu.uci.ics.jung.graph.util.EdgeType edgeType)Returns the edges for a given edge type.edu.uci.ics.jung.graph.util.EdgeTypegetEdgeType(java.lang.Object edge)Returns the edge type of en edge.edu.uci.ics.jung.graph.util.PairgetEndpoints(java.lang.Object edge)Returns the endpoints of the edge.static org.apache.commons.collections15.FactorygetFactory()Returns the factory for the graph.protected java.util.CollectiongetIncident_internal(java.lang.Object vertex)Returns the incident edges of the vertexjava.util.CollectiongetIncidentEdges(java.lang.Object vertex)Returns the incident edges of the vertex.protected java.util.CollectiongetIncoming_internal(java.lang.Object vertex)Returns the incoming edges of the vertexjava.util.CollectiongetInEdges(java.lang.Object vertex)Returns the incoming edges of the vertex.java.util.CollectiongetNeighbors(java.lang.Object vertex)Returns the neighbor vertices of a given vertex.java.util.CollectiongetOutEdges(java.lang.Object vertex)Returns the outgoing edges of the vertex.protected java.util.CollectiongetOutgoing_internal(java.lang.Object vertex)Returns the outgoing edges of the vertexjava.util.CollectiongetPredecessors(java.lang.Object vertex)Returns the vertices that have an outgoing edge to the given vertex.java.lang.ObjectgetSource(java.lang.Object directed_edge)Returns the source of a directed edge.java.util.CollectiongetSuccessors(java.lang.Object vertex)Returns the vertices that have an incoming edge from the given vertex.intgetVertexCount()java.util.CollectiongetVertices()Returns all vertices of the graph.booleanisDest(java.lang.Object vertex, java.lang.Object edge)Returnstrueif the vertex is the destination of the edge.booleanisSource(java.lang.Object vertex, java.lang.Object edge)Returnstrueif the vertex is the source of the edge.booleanremoveEdge(java.lang.Object edge)Removes a edge from the graph.booleanremoveVertex(java.lang.Object vertex)Removes a vertex from the graph.-
Methods inherited from class edu.uci.ics.jung.graph.AbstractGraph
addEdge, addEdge, getIncidentCount, getIncidentVertices, getNeighborCount, getOpposite, getPredecessorCount, getSuccessorCount, getValidatedEndpoints, inDegree, isIncident, isNeighbor, isPredecessor, isSuccessor, outDegree, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
-
-
-
Field Detail
-
INCOMING
protected static final int INCOMING
Indicates incoming edges in the map- See Also:
- Constant Field Values
-
OUTGOING
protected static final int OUTGOING
Indicates outgoing edges in the map- See Also:
- Constant Field Values
-
INCIDENT
protected static final int INCIDENT
Indicates incident (undirected) edges in the map- See Also:
- Constant Field Values
-
mvertex_maps
protected java.util.Map mvertex_maps
Map of vertices to adjacency maps of vertices to {incoming, outgoing, incident} edges
-
mdirected_edges
protected java.util.Map mdirected_edges
Map of directed edges to incident vertex sets
-
mundirected_edges
protected java.util.Map mundirected_edges
Map of undirected edges to incident vertex sets
-
-
Method Detail
-
getFactory
public static org.apache.commons.collections15.Factory getFactory()
Returns the factory for the graph.- Returns:
- The Factory for the graph..
-
create
public static edu.uci.ics.jung.graph.Graph create()
Returns a new MultidirectedMultiGraph.- Returns:
- The MultidirectedMultiGraph.
-
addEdge
public boolean addEdge(java.lang.Object edge, edu.uci.ics.jung.graph.util.Pair endpoints)Adds a directed edge to the graph.- Overrides:
addEdgein classedu.uci.ics.jung.graph.AbstractGraph- Parameters:
edge- The edge.endpoints- The endpoints.- Returns:
trueif success.
-
addEdge
public boolean addEdge(java.lang.Object edge, edu.uci.ics.jung.graph.util.Pair endpoints, edu.uci.ics.jung.graph.util.EdgeType edgeType)Adds a edge to the graph with a specific edge type.- Overrides:
addEdgein classedu.uci.ics.jung.graph.SparseGraph- Parameters:
edge- The edge.endpoints- The endpoints.edgeType- The edge type.- Returns:
trueif success.
-
addEdge
public boolean addEdge(java.lang.Object e, java.lang.Object v1, java.lang.Object v2)Adds a directed edge to the graph.- Specified by:
addEdgein interfaceedu.uci.ics.jung.graph.Graph- Overrides:
addEdgein classedu.uci.ics.jung.graph.AbstractGraph- Parameters:
edge- The edge.v1- The first vertex.v2- The second vertex.- Returns:
trueif success.
-
addEdge
public boolean addEdge(java.lang.Object e, java.lang.Object v1, java.lang.Object v2, edu.uci.ics.jung.graph.util.EdgeType edgeType)Adds a edge to the graph with a specific edge type.- Specified by:
addEdgein interfaceedu.uci.ics.jung.graph.Graph- Overrides:
addEdgein classedu.uci.ics.jung.graph.AbstractGraph- Parameters:
edge- The edge.v1- The first vertex.v2- The second vertex..edgeType- The edge type.- Returns:
trueif success.
-
findEdge
public java.lang.Object findEdge(java.lang.Object v1, java.lang.Object v2)Returns the first edge between the two vertices.- Specified by:
findEdgein interfaceedu.uci.ics.jung.graph.Hypergraph- Overrides:
findEdgein classedu.uci.ics.jung.graph.SparseGraph- Parameters:
v1- The first vertex.v2- The second vertex.- Returns:
- The edge or
nullif there is no incident edge between the vertices.
-
findEdgeSet
public java.util.Collection findEdgeSet(java.lang.Object v1, java.lang.Object v2)Returns a collection of edges between the two vertices.- Specified by:
findEdgeSetin interfaceedu.uci.ics.jung.graph.Hypergraph- Overrides:
findEdgeSetin classedu.uci.ics.jung.graph.SparseGraph- Parameters:
v1- The first vertex.v2- The second vertex.- Returns:
- The collection of edges or
nullif there is no incident edge between the vertices.
-
getInEdges
public java.util.Collection getInEdges(java.lang.Object vertex)
Returns the incoming edges of the vertex.- Specified by:
getInEdgesin interfaceedu.uci.ics.jung.graph.Graph- Specified by:
getInEdgesin interfaceedu.uci.ics.jung.graph.Hypergraph- Overrides:
getInEdgesin classedu.uci.ics.jung.graph.SparseGraph- Parameters:
vertex- The vertx- Returns:
- The collection of edges.
-
getOutEdges
public java.util.Collection getOutEdges(java.lang.Object vertex)
Returns the outgoing edges of the vertex.- Specified by:
getOutEdgesin interfaceedu.uci.ics.jung.graph.Graph- Specified by:
getOutEdgesin interfaceedu.uci.ics.jung.graph.Hypergraph- Overrides:
getOutEdgesin classedu.uci.ics.jung.graph.SparseGraph- Parameters:
vertex- The vertx- Returns:
- The collection of edges.
-
getPredecessors
public java.util.Collection getPredecessors(java.lang.Object vertex)
Returns the vertices that have an outgoing edge to the given vertex.- Specified by:
getPredecessorsin interfaceedu.uci.ics.jung.graph.Graph- Specified by:
getPredecessorsin interfaceedu.uci.ics.jung.graph.Hypergraph- Overrides:
getPredecessorsin classedu.uci.ics.jung.graph.SparseGraph- Parameters:
vertex- The vertex.- Returns:
- The collection of vertices.
-
getSuccessors
public java.util.Collection getSuccessors(java.lang.Object vertex)
Returns the vertices that have an incoming edge from the given vertex.- Specified by:
getSuccessorsin interfaceedu.uci.ics.jung.graph.Graph- Specified by:
getSuccessorsin interfaceedu.uci.ics.jung.graph.Hypergraph- Overrides:
getSuccessorsin classedu.uci.ics.jung.graph.SparseGraph- Parameters:
vertex- The vertex.- Returns:
- The collection of vertices.
-
getEdges
public java.util.Collection getEdges(edu.uci.ics.jung.graph.util.EdgeType edgeType)
Returns the edges for a given edge type.- Specified by:
getEdgesin interfaceedu.uci.ics.jung.graph.Hypergraph- Overrides:
getEdgesin classedu.uci.ics.jung.graph.SparseGraph- Parameters:
edgeType- The edge tzpe.- Returns:
- The collection of edges.
-
getEndpoints
public edu.uci.ics.jung.graph.util.Pair getEndpoints(java.lang.Object edge)
Returns the endpoints of the edge.- Specified by:
getEndpointsin interfaceedu.uci.ics.jung.graph.Graph- Overrides:
getEndpointsin classedu.uci.ics.jung.graph.SparseGraph- Parameters:
edge- The edge.- Returns:
- The endpoints.
-
getEdgeType
public edu.uci.ics.jung.graph.util.EdgeType getEdgeType(java.lang.Object edge)
Returns the edge type of en edge.- Specified by:
getEdgeTypein interfaceedu.uci.ics.jung.graph.Hypergraph- Overrides:
getEdgeTypein classedu.uci.ics.jung.graph.SparseGraph- Parameters:
edge- The edge.- Returns:
- The edge type.
-
getSource
public java.lang.Object getSource(java.lang.Object directed_edge)
Returns the source of a directed edge.- Specified by:
getSourcein interfaceedu.uci.ics.jung.graph.Graph- Specified by:
getSourcein interfaceedu.uci.ics.jung.graph.Hypergraph- Overrides:
getSourcein classedu.uci.ics.jung.graph.SparseGraph- Parameters:
directed_edge- The edge.- Returns:
- The vertex.
-
getDest
public java.lang.Object getDest(java.lang.Object directed_edge)
Returns the destination of a directed edge.- Specified by:
getDestin interfaceedu.uci.ics.jung.graph.Graph- Specified by:
getDestin interfaceedu.uci.ics.jung.graph.Hypergraph- Overrides:
getDestin classedu.uci.ics.jung.graph.SparseGraph- Parameters:
directed_edge- The edge.- Returns:
- The vertex.
-
isSource
public boolean isSource(java.lang.Object vertex, java.lang.Object edge)Returnstrueif the vertex is the source of the edge.- Specified by:
isSourcein interfaceedu.uci.ics.jung.graph.Graph- Overrides:
isSourcein classedu.uci.ics.jung.graph.SparseGraph- Parameters:
vertex- The vertex.edge- The edge.- Returns:
trueif the vertex is the source.
-
isDest
public boolean isDest(java.lang.Object vertex, java.lang.Object edge)Returnstrueif the vertex is the destination of the edge.- Specified by:
isDestin interfaceedu.uci.ics.jung.graph.Graph- Overrides:
isDestin classedu.uci.ics.jung.graph.SparseGraph- Parameters:
vertex- The vertex.edge- The edge.- Returns:
trueif the vertex is the destination.
-
getEdges
public java.util.Collection getEdges()
Returns all edges of the graph.- Specified by:
getEdgesin interfaceedu.uci.ics.jung.graph.Hypergraph- Overrides:
getEdgesin classedu.uci.ics.jung.graph.SparseGraph- Returns:
- The collection of edges.
-
getVertices
public java.util.Collection getVertices()
Returns all vertices of the graph.- Specified by:
getVerticesin interfaceedu.uci.ics.jung.graph.Hypergraph- Overrides:
getVerticesin classedu.uci.ics.jung.graph.SparseGraph- Returns:
- The collection of vertices.
-
containsVertex
public boolean containsVertex(java.lang.Object vertex)
Returnstrueif the graph contains the vertex.- Specified by:
containsVertexin interfaceedu.uci.ics.jung.graph.Hypergraph- Overrides:
containsVertexin classedu.uci.ics.jung.graph.SparseGraph- Parameters:
vertex- The vertex.- Returns:
trueif the vertex is in the graph.
-
containsEdge
public boolean containsEdge(java.lang.Object edge)
Returnstrueif the graph contains the edge.- Specified by:
containsEdgein interfaceedu.uci.ics.jung.graph.Hypergraph- Overrides:
containsEdgein classedu.uci.ics.jung.graph.SparseGraph- Parameters:
edge- The edge.- Returns:
trueif the edge is in the graph.
-
getEdgeCount
public int getEdgeCount()
- Specified by:
getEdgeCountin interfaceedu.uci.ics.jung.graph.Hypergraph- Overrides:
getEdgeCountin classedu.uci.ics.jung.graph.SparseGraph- Returns:
- The edge count.
-
getVertexCount
public int getVertexCount()
- Specified by:
getVertexCountin interfaceedu.uci.ics.jung.graph.Hypergraph- Overrides:
getVertexCountin classedu.uci.ics.jung.graph.SparseGraph- Returns:
- The vertex count.
-
getNeighbors
public java.util.Collection getNeighbors(java.lang.Object vertex)
Returns the neighbor vertices of a given vertex.- Specified by:
getNeighborsin interfaceedu.uci.ics.jung.graph.Hypergraph- Overrides:
getNeighborsin classedu.uci.ics.jung.graph.SparseGraph- Parameters:
vertex- The vertex.- Returns:
- The collection of neighbors.
-
degree
public int degree(java.lang.Object vertex)
Returns the degree (number of incident edges) of a vertex.- Specified by:
degreein interfaceedu.uci.ics.jung.graph.Hypergraph- Overrides:
degreein classedu.uci.ics.jung.graph.AbstractGraph- Parameters:
vertex- The vertex.- Returns:
- The degree.
-
getIncidentEdges
public java.util.Collection getIncidentEdges(java.lang.Object vertex)
Returns the incident edges of the vertex.- Specified by:
getIncidentEdgesin interfaceedu.uci.ics.jung.graph.Hypergraph- Overrides:
getIncidentEdgesin classedu.uci.ics.jung.graph.SparseGraph- Parameters:
vertex- The vertex.- Returns:
- The collection of edges.
-
addVertex
public boolean addVertex(java.lang.Object vertex)
Adds a vertex to the graph.- Specified by:
addVertexin interfaceedu.uci.ics.jung.graph.Hypergraph- Overrides:
addVertexin classedu.uci.ics.jung.graph.SparseGraph- Parameters:
vertex- The vertex.- Returns:
trueif success.
-
removeVertex
public boolean removeVertex(java.lang.Object vertex)
Removes a vertex from the graph.- Specified by:
removeVertexin interfaceedu.uci.ics.jung.graph.Hypergraph- Overrides:
removeVertexin classedu.uci.ics.jung.graph.SparseGraph- Parameters:
vertex- The vertex.- Returns:
trueif success
-
removeEdge
public boolean removeEdge(java.lang.Object edge)
Removes a edge from the graph.- Specified by:
removeEdgein interfaceedu.uci.ics.jung.graph.Hypergraph- Overrides:
removeEdgein classedu.uci.ics.jung.graph.SparseGraph- Parameters:
edge- The edge.- Returns:
trueif success
-
getIncoming_internal
protected java.util.Collection getIncoming_internal(java.lang.Object vertex)
Returns the incoming edges of the vertex- Parameters:
vertex- The vertex.- Returns:
- The collection of edges.
-
getIncident_internal
protected java.util.Collection getIncident_internal(java.lang.Object vertex)
Returns the incident edges of the vertex- Parameters:
vertex- The vertex.- Returns:
- The collection of edges.
-
getOutgoing_internal
protected java.util.Collection getOutgoing_internal(java.lang.Object vertex)
Returns the outgoing edges of the vertex- Parameters:
vertex- The vertex.- Returns:
- The collection of edges.
-
-