org.gersteinlab.tyna.core.graph
Class DirectedSimpleGraph

java.lang.Object
  extended by org.gersteinlab.tyna.core.graph.AbstractGraph
      extended by org.gersteinlab.tyna.core.graph.AbstractSimpleGraph
          extended by org.gersteinlab.tyna.core.graph.DirectedSimpleGraph
All Implemented Interfaces:
java.io.Serializable, AdvancedDirectedGraph, AdvancedGraph, DirectedGraph, Graph, SimpleGraph

public class DirectedSimpleGraph
extends AbstractSimpleGraph
implements AdvancedDirectedGraph

        This class represents a directed simple graph. See DirectedGraph and
        SimpleGraph for definitions.
        

Version:
1.0 (September 21, 2005) Change History: 1.0 - Initial version
Author:
Kevin Yuk-Lap Yip
See Also:
Serialized Form

Nested Class Summary
protected  class DirectedSimpleGraph.DirectedSimpleGraphEdgeIterator
           
 
Nested classes/interfaces inherited from class org.gersteinlab.tyna.core.graph.AbstractSimpleGraph
AbstractSimpleGraph.AbstractSimpleGraphEdgeIterator
 
Nested classes/interfaces inherited from class org.gersteinlab.tyna.core.graph.AbstractGraph
AbstractGraph.AbstractGraphEdgeIterator, AbstractGraph.AbstractGraphNodeIterator, AbstractGraph.BetweennessNode, AbstractGraph.DuplicateTree, AbstractGraph.HeadTailTree, AbstractGraph.HeadTree, AbstractGraph.TailTree
 
Field Summary
 
Fields inherited from class org.gersteinlab.tyna.core.graph.AbstractGraph
attrs, edgeCount, edges, lastModified, nodes, revEdges
 
Constructor Summary
DirectedSimpleGraph()
          Default constructor: creates an empty graph.
DirectedSimpleGraph(Graph graph)
           
 
Method Summary
 EdgeIterator getEdgeIterator()
          Return an iterator of the edges in the graph.
 java.util.List getFeedforwardLoops(int minSize, int maxSize)
          Get all chains of distinct nodes that .
 int getInDegree(Node node)
          Get the in-degree of a node.
 java.util.Map getInDegrees()
          Get the in-degrees of all nodes in the graph.
 java.util.List getInEdges(Node node)
          Get the in-edges of a node.
 java.util.Set getInNeighbors(Node node)
          Get the in-neighbors of a node.
 java.util.List getMaximalCompleteTwoLayerSubgraphs(int minSize1, int maxSize1, int minSize2)
          Get all maximal motifs that contain two layers of nodes such that .
 int getOutDegree(Node node)
          Get the out-degree of a node.
 java.util.Map getOutDegrees()
          Get the out-degrees of all nodes in the graph.
 java.util.List getOutEdges(Node node)
          Get the out-edges of a node.
 java.util.Set getOutNeighbors(Node node)
          Get the out-neighbors of a node.
 
Methods inherited from class org.gersteinlab.tyna.core.graph.AbstractSimpleGraph
addEdge
 
Methods inherited from class org.gersteinlab.tyna.core.graph.AbstractGraph
accumulateLocalBetweenness, addNode, checkEdge, checkNode, computeLocalBetweenness, containsEdge, containsNode, getAdjacencyMatrix, getAllUnweightedShortestPaths, getAllUnweightedShortestPaths, getAllUnweightedShortestPaths, getAttr, getAttrs, getBetweenness, getBetweennesses, getClusCoef, getClusCoefs, getConnectedComponentCount, getConnectedComponents, getCycles, getCycles, getDefectiveCliquesMissingEdges, getDegree, getDegrees, getDiffusionDistanceMatrix, getDiffusionDistanceMatrix, getEccentricities, getEccentricity, getEdgeBetweennesses, getEdgeCount, getEdgeNodePairs, getEdges, getFeedforwardLoops, getLaplacianMatrix, getLaplacianMatrix, getMaximalChains, getMaximalCliques, getMaximalIndependentSets, getMinimalChains, getNeighbors, getNode, getNodeCount, getNodeIterator, getUnweightedShortestPath, getUnweightedShortestPathLength, getUnweightedShortestPathLengths, getUnweightedShortestPathLengths, getUnweightedShortestPaths, getUnweightedShortestPaths, getUnweightedShortestPaths, getUnweightedShortestPaths, markModified, saveGraph, setAttr
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.gersteinlab.tyna.core.graph.Graph
addEdge, addNode, containsEdge, containsNode, getAttr, getAttrs, getEdgeCount, getEdgeNodePairs, getNode, getNodeCount, getNodeIterator, setAttr
 

Constructor Detail

DirectedSimpleGraph

public DirectedSimpleGraph()
Default constructor: creates an empty graph.


DirectedSimpleGraph

public DirectedSimpleGraph(Graph graph)
                    throws GraphTypeException
Throws:
GraphTypeException
See Also:
AbstractGraph.AbstractGraph(Graph)
Method Detail

getEdgeIterator

public EdgeIterator getEdgeIterator()
Description copied from interface: Graph
Return an iterator of the edges in the graph. Unless otherwise specified by the implemented class, the edge order in the returned iterator needs not be predictable from the order in which the edges are added and/or removed.

Specified by:
getEdgeIterator in interface Graph
Returns:
The iterator

getInDegree

public int getInDegree(Node node)
                throws java.lang.IllegalArgumentException,
                       java.lang.NullPointerException
Description copied from interface: DirectedGraph
Get the in-degree of a node.

Specified by:
getInDegree in interface DirectedGraph
Overrides:
getInDegree in class AbstractSimpleGraph
Parameters:
node - The node
Returns:
The in-degree of the node
Throws:
java.lang.IllegalArgumentException - If the node is not in the graph
java.lang.NullPointerException
See Also:
DirectedGraph.getInDegree(Node)

getOutDegree

public int getOutDegree(Node node)
                 throws java.lang.IllegalArgumentException,
                        java.lang.NullPointerException
Description copied from interface: DirectedGraph
Get the out-degree of a node.

Specified by:
getOutDegree in interface DirectedGraph
Overrides:
getOutDegree in class AbstractSimpleGraph
Parameters:
node - The node
Returns:
The out-degree of the node
Throws:
java.lang.IllegalArgumentException - If the node is not in the graph
java.lang.NullPointerException
See Also:
DirectedGraph.getOutDegree(Node)

getInDegrees

public java.util.Map getInDegrees()
Description copied from interface: DirectedGraph
Get the in-degrees of all nodes in the graph.

Specified by:
getInDegrees in interface DirectedGraph
Overrides:
getInDegrees in class AbstractGraph
Returns:
The in-degrees, in a map from Node to Integer
See Also:
DirectedGraph.getInDegrees()

getOutDegrees

public java.util.Map getOutDegrees()
Description copied from interface: DirectedGraph
Get the out-degrees of all nodes in the graph.

Specified by:
getOutDegrees in interface DirectedGraph
Overrides:
getOutDegrees in class AbstractGraph
Returns:
The out-degrees, in a map from Node to Integer
See Also:
DirectedGraph.getOutDegrees()

getInEdges

public java.util.List getInEdges(Node node)
                          throws java.lang.IllegalArgumentException,
                                 java.lang.NullPointerException
Description copied from interface: DirectedGraph
Get the in-edges of a node.

Specified by:
getInEdges in interface DirectedGraph
Overrides:
getInEdges in class AbstractSimpleGraph
Parameters:
node - The node
Returns:
The in-edges of the node
Throws:
java.lang.IllegalArgumentException - If the node is not in the graph
java.lang.NullPointerException
See Also:
DirectedGraph.getInEdges(Node)

getOutEdges

public java.util.List getOutEdges(Node node)
                           throws java.lang.IllegalArgumentException,
                                  java.lang.NullPointerException
Description copied from interface: DirectedGraph
Get the out-edges of a node.

Specified by:
getOutEdges in interface DirectedGraph
Overrides:
getOutEdges in class AbstractSimpleGraph
Parameters:
node - The node
Returns:
The out-edges of the node
Throws:
java.lang.IllegalArgumentException - If the node is not in the graph
java.lang.NullPointerException
See Also:
DirectedGraph.getOutEdges(Node)

getInNeighbors

public java.util.Set getInNeighbors(Node node)
                             throws java.lang.IllegalArgumentException,
                                    java.lang.NullPointerException
Description copied from interface: DirectedGraph
Get the in-neighbors of a node.

Specified by:
getInNeighbors in interface DirectedGraph
Overrides:
getInNeighbors in class AbstractGraph
Parameters:
node - The node
Returns:
The in-neighbors of the node
Throws:
java.lang.IllegalArgumentException - If the node is not in the graph
java.lang.NullPointerException
See Also:
DirectedGraph.getInNeighbors(Node)

getOutNeighbors

public java.util.Set getOutNeighbors(Node node)
                              throws java.lang.IllegalArgumentException,
                                     java.lang.NullPointerException
Description copied from interface: DirectedGraph
Get the out-neighbors of a node.

Specified by:
getOutNeighbors in interface DirectedGraph
Overrides:
getOutNeighbors in class AbstractGraph
Parameters:
node - The node
Returns:
The out-neighbors of the node
Throws:
java.lang.IllegalArgumentException - If the node is not in the graph
java.lang.NullPointerException
See Also:
DirectedGraph.getOutNeighbors(Node)

getFeedforwardLoops

public java.util.List getFeedforwardLoops(int minSize,
                                          int maxSize)
                                   throws java.lang.IllegalArgumentException
Description copied from interface: AdvancedDirectedGraph
Get all chains of distinct nodes that . Have at least minSize nodes . Have at most maxSize nodes . Have the first node connected to the last one

Specified by:
getFeedforwardLoops in interface AdvancedDirectedGraph
Overrides:
getFeedforwardLoops in class AbstractGraph
Returns:
A list of Node[], each representing a feed-forward loop by an array of distinct nodes
Throws:
java.lang.IllegalArgumentException - If the input sizes are invalid
See Also:
AdvancedDirectedGraph.getFeedforwardLoops(int,int)

getMaximalCompleteTwoLayerSubgraphs

public java.util.List getMaximalCompleteTwoLayerSubgraphs(int minSize1,
                                                          int maxSize1,
                                                          int minSize2)
                                                   throws java.lang.IllegalArgumentException
Description copied from interface: AdvancedDirectedGraph
Get all maximal motifs that contain two layers of nodes such that . There are at least minSize1 nodes in the first layer . There are at most maxSize1 nodes in the first layer . There are at least minSize2 nodes in the second layer . All nodes in the first layer has a directed edge to all nodes in the second layer . There does not exist any node not in the first layer also has a directed edge to all nodes in the second layer . There does not exist any node not in the second layer also has a directed edge from all nodes in the first layer

Specified by:
getMaximalCompleteTwoLayerSubgraphs in interface AdvancedDirectedGraph
Overrides:
getMaximalCompleteTwoLayerSubgraphs in class AbstractGraph
Returns:
A list of Node[][], each representing an array of two arrays of nodes, the first one for the first layer and the second one for the second layer
Throws:
java.lang.IllegalArgumentException - If the input sizes are invalid
See Also:
AdvancedDirectedGraph.getMaximalCompleteTwoLayerSubgraphs(int, int, int)