org.expasy.jpl.commons.collection.graph
Class KPartiteGraphImpl<V,E>

java.lang.Object
  extended by edu.uci.ics.jung.graph.AbstractGraph<V,E>
      extended by edu.uci.ics.jung.graph.SparseMultigraph<V,E>
          extended by org.expasy.jpl.commons.collection.graph.KPartiteGraphImpl<V,E>
Type Parameters:
V - vertex type.
E - edge type.
All Implemented Interfaces:
edu.uci.ics.jung.graph.Graph<V,E>, edu.uci.ics.jung.graph.Hypergraph<V,E>, edu.uci.ics.jung.graph.KPartiteGraph<V,E>, edu.uci.ics.jung.graph.MultiGraph<V,E>, Serializable, Registrable, Node

public final class KPartiteGraphImpl<V,E>
extends edu.uci.ics.jung.graph.SparseMultigraph<V,E>
implements edu.uci.ics.jung.graph.KPartiteGraph<V,E>, Node

A simple implementation of KPartiteGraph.

Version:
1.0
Author:
nikitin
See Also:
Serialized Form

Nested Class Summary
static class KPartiteGraphImpl.Collapser<V,E>
           
static class KPartiteGraphImpl.PredicateImpl<T>
           
 
Field Summary
 
Fields inherited from class edu.uci.ics.jung.graph.SparseMultigraph
directedEdges, edges, vertices
 
Constructor Summary
KPartiteGraphImpl()
           
 
Method Summary
 boolean addEdge(E edge, V v1, V v2)
           
 boolean addEdge(E edge, V v1, V v2, edu.uci.ics.jung.graph.util.EdgeType type)
           
 boolean addVertex(V vertex)
           
 int getEdgeCount(Collection<org.apache.commons.collections15.Predicate<V>> predicates)
           
 int getEdgeCount(org.apache.commons.collections15.Predicate<V> predicate)
           
 Collection<E> getEdges(Collection<org.apache.commons.collections15.Predicate<V>> predicates)
           
 Collection<E> getEdges(org.apache.commons.collections15.Predicate<V> predicate)
           
 String getId()
           
 Collection<E> getIncidentEdges(V vertex, Collection<org.apache.commons.collections15.Predicate<V>> predicates)
           
 Collection<E> getIncidentEdges(V vertex, org.apache.commons.collections15.Predicate<V> predicate)
           
 Set<V> getNeighbors(V vertex, Collection<org.apache.commons.collections15.Predicate<V>> predicates)
           
 Collection<V> getNeighbors(V vertex, org.apache.commons.collections15.Predicate<V> predicate)
           
 int getPartitionIndex(org.apache.commons.collections15.Predicate<V> predicate)
           
 int getPartitionIndex(V vertex)
          Look for the partition of the given vertex.
 Collection<org.apache.commons.collections15.Predicate<V>> getPartitions()
           
 V getVertex(String id)
           
 int getVertexCount(Collection<org.apache.commons.collections15.Predicate<V>> predicates)
           
 int getVertexCount(org.apache.commons.collections15.Predicate<V> predicate)
           
 Collection<V> getVertices(Collection<org.apache.commons.collections15.Predicate<V>> predicates)
           
 Collection<V> getVertices(org.apache.commons.collections15.Predicate<V> predicate)
           
 Set<String> getVerticesId()
           
static
<V,E> KPartiteGraphImpl<V,E>
newInstance(List<org.apache.commons.collections15.Predicate<V>> partitions, boolean subsets)
           
 boolean removeEdge(E edge)
           
 boolean removeVertex(V vertex)
           
 void setId(String id)
           
 void setPartitions(Collection<org.apache.commons.collections15.Predicate<V>> predicates)
           
 String toString()
           
 
Methods inherited from class edu.uci.ics.jung.graph.SparseMultigraph
addEdge, containsEdge, containsVertex, findEdge, getDefaultEdgeType, getDest, getEdgeCount, getEdgeCount, getEdges, getEdges, getEdgeType, getEndpoints, getFactory, getIncidentEdges, getIncoming_internal, getInEdges, getNeighbors, getOutEdges, getOutgoing_internal, getPredecessors, getSource, getSuccessors, getVertexCount, getVertices, isDest, isSource
 
Methods inherited from class edu.uci.ics.jung.graph.AbstractGraph
addEdge, addEdge, addEdge, degree, findEdgeSet, getIncidentCount, getIncidentVertices, getNeighborCount, getOpposite, getPredecessorCount, getSuccessorCount, getValidatedEndpoints, inDegree, isIncident, isNeighbor, isPredecessor, isSuccessor, outDegree
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface edu.uci.ics.jung.graph.Graph
getDest, getEndpoints, getInEdges, getOpposite, getOutEdges, getPredecessorCount, getPredecessors, getSource, getSuccessorCount, getSuccessors, inDegree, isDest, isPredecessor, isSource, isSuccessor, outDegree
 
Methods inherited from interface edu.uci.ics.jung.graph.Hypergraph
addEdge, addEdge, containsEdge, containsVertex, degree, findEdge, findEdgeSet, getDefaultEdgeType, getEdgeCount, getEdgeCount, getEdges, getEdges, getEdgeType, getIncidentCount, getIncidentEdges, getIncidentVertices, getNeighborCount, getNeighbors, getVertexCount, getVertices, isIncident, isNeighbor
 

Constructor Detail

KPartiteGraphImpl

public KPartiteGraphImpl()
Method Detail

newInstance

public static <V,E> KPartiteGraphImpl<V,E> newInstance(List<org.apache.commons.collections15.Predicate<V>> partitions,
                                                       boolean subsets)

setId

public void setId(String id)

setPartitions

public void setPartitions(Collection<org.apache.commons.collections15.Predicate<V>> predicates)

getPartitionIndex

public int getPartitionIndex(org.apache.commons.collections15.Predicate<V> predicate)

getPartitionIndex

public int getPartitionIndex(V vertex)
Look for the partition of the given vertex.

Parameters:
vertex - the vertex to search partition index from.
Returns:
the partition index or -1 if not found.

getPartitions

public Collection<org.apache.commons.collections15.Predicate<V>> getPartitions()
Specified by:
getPartitions in interface edu.uci.ics.jung.graph.KPartiteGraph<V,E>

addVertex

public boolean addVertex(V vertex)
Specified by:
addVertex in interface edu.uci.ics.jung.graph.Hypergraph<V,E>
Overrides:
addVertex in class edu.uci.ics.jung.graph.SparseMultigraph<V,E>

removeVertex

public boolean removeVertex(V vertex)
Specified by:
removeVertex in interface edu.uci.ics.jung.graph.Hypergraph<V,E>
Overrides:
removeVertex in class edu.uci.ics.jung.graph.SparseMultigraph<V,E>

addEdge

public boolean addEdge(E edge,
                       V v1,
                       V v2)
Specified by:
addEdge in interface edu.uci.ics.jung.graph.Graph<V,E>
Overrides:
addEdge in class edu.uci.ics.jung.graph.AbstractGraph<V,E>

addEdge

public boolean addEdge(E edge,
                       V v1,
                       V v2,
                       edu.uci.ics.jung.graph.util.EdgeType type)
Specified by:
addEdge in interface edu.uci.ics.jung.graph.Graph<V,E>
Overrides:
addEdge in class edu.uci.ics.jung.graph.AbstractGraph<V,E>

removeEdge

public boolean removeEdge(E edge)
Specified by:
removeEdge in interface edu.uci.ics.jung.graph.Hypergraph<V,E>
Overrides:
removeEdge in class edu.uci.ics.jung.graph.SparseMultigraph<V,E>

getVerticesId

public Set<String> getVerticesId()

getVertex

public V getVertex(String id)

getVertexCount

public int getVertexCount(org.apache.commons.collections15.Predicate<V> predicate)

getVertexCount

public int getVertexCount(Collection<org.apache.commons.collections15.Predicate<V>> predicates)

getEdgeCount

public int getEdgeCount(org.apache.commons.collections15.Predicate<V> predicate)

getEdgeCount

public int getEdgeCount(Collection<org.apache.commons.collections15.Predicate<V>> predicates)

getVertices

public Collection<V> getVertices(Collection<org.apache.commons.collections15.Predicate<V>> predicates)
Returns:
all vertices which satisfy the specified node type predicate.
Throws:
IllegalArgumentException - if not valid predicate.

getVertices

public Collection<V> getVertices(org.apache.commons.collections15.Predicate<V> predicate)
Specified by:
getVertices in interface edu.uci.ics.jung.graph.KPartiteGraph<V,E>
Returns:
all vertices which satisfy the specified node type predicate.
Throws:
IllegalArgumentException - if not valid predicate.

getNeighbors

public Set<V> getNeighbors(V vertex,
                           Collection<org.apache.commons.collections15.Predicate<V>> predicates)

getNeighbors

public Collection<V> getNeighbors(V vertex,
                                  org.apache.commons.collections15.Predicate<V> predicate)

getEdges

public Collection<E> getEdges(org.apache.commons.collections15.Predicate<V> predicate)

getEdges

public Collection<E> getEdges(Collection<org.apache.commons.collections15.Predicate<V>> predicates)

getIncidentEdges

public Collection<E> getIncidentEdges(V vertex,
                                      Collection<org.apache.commons.collections15.Predicate<V>> predicates)

getIncidentEdges

public Collection<E> getIncidentEdges(V vertex,
                                      org.apache.commons.collections15.Predicate<V> predicate)

getId

public final String getId()
Specified by:
getId in interface Registrable
Returns:
the identifier

toString

public String toString()
Overrides:
toString in class edu.uci.ics.jung.graph.AbstractGraph<V,E>


Copyright (c) 2012 Swiss Institute of Bioinformatics. All rights reserved.