org.gersteinlab.tyna.core.graph
Class UndirectedMultiGraph

java.lang.Object
  extended by org.gersteinlab.tyna.core.graph.AbstractGraph
      extended by org.gersteinlab.tyna.core.graph.AbstractMultiGraph
          extended by org.gersteinlab.tyna.core.graph.UndirectedMultiGraph
All Implemented Interfaces:
java.io.Serializable, AdvancedGraph, AdvancedUndirectedGraph, Graph, MultiGraph, UndirectedGraph

public class UndirectedMultiGraph
extends AbstractMultiGraph
implements AdvancedUndirectedGraph

        This class represents an undirected multigraph. See UndirectedGraph
        and MultiGraph for definitions.
        

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

Nested Class Summary
protected  class UndirectedMultiGraph.UndirectedMultiGraphEdgeIterator
           
 
Nested classes/interfaces inherited from class org.gersteinlab.tyna.core.graph.AbstractMultiGraph
AbstractMultiGraph.AbstractMultiGraphEdgeIterator
 
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
UndirectedMultiGraph()
          Default constructor: creates an empty graph.
UndirectedMultiGraph(Graph graph)
           
 
Method Summary
 java.util.List getDefectiveCliquesMissingEdges(int k, int l)
          Get the missing edges in defective cliques formed by two cliques with .
 int getDegree(Node node)
          Get the degree of a node.
 java.util.Map getDegrees()
          Get the degrees of all nodes in the graph.
 double[][] getDiffusionDistanceMatrix(double beta, int[][] laplacianMatrix)
          Get the diffusion distance matrix of a subgraph according to a given Laplacian matrix.
 double[][] getDiffusionDistanceMatrix(double beta, java.util.List nodeList)
          Get the diffusion distance matrix of a subgraph according to a given node order.
 EdgeIterator getEdgeIterator()
          Return an iterator of the edges in the graph.
 java.util.List getEdges(Node node)
          Get the edges incident on a node.
 int[][] getLaplacianMatrix(int[][] adjacencyMatrix)
          Get the Laplacian matrix of a subgraph according to a given adjacency matrix.
 int[][] getLaplacianMatrix(java.util.List nodeList)
          Get the Laplacian matrix of a subgraph according to a given node order.
 java.util.List getMaximalCliques()
          Get all maximal cliques
 java.util.List getMaximalIndependentSets()
          Get all maximal independent sets
 java.util.Set getNeighbors(Node node)
          Get the neighbors of a node.
 
Methods inherited from class org.gersteinlab.tyna.core.graph.AbstractMultiGraph
addEdge, getInDegree, getInEdges, getOutDegree, getOutEdges
 
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, getEccentricities, getEccentricity, getEdgeBetweennesses, getEdgeCount, getEdgeNodePairs, getFeedforwardLoops, getFeedforwardLoops, getInDegrees, getInNeighbors, getMaximalChains, getMaximalCompleteTwoLayerSubgraphs, getMinimalChains, getNode, getNodeCount, getNodeIterator, getOutDegrees, getOutNeighbors, 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

UndirectedMultiGraph

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


UndirectedMultiGraph

public UndirectedMultiGraph(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

getDegree

public int getDegree(Node node)
              throws java.lang.IllegalArgumentException,
                     java.lang.NullPointerException
Description copied from interface: UndirectedGraph
Get the degree of a node.

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

getDegrees

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

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

getEdges

public java.util.List getEdges(Node node)
                        throws java.lang.IllegalArgumentException,
                               java.lang.NullPointerException
Description copied from interface: UndirectedGraph
Get the edges incident on a node.

Specified by:
getEdges in interface UndirectedGraph
Overrides:
getEdges in class AbstractGraph
Parameters:
node - The node
Returns:
The edges incident on the node
Throws:
java.lang.IllegalArgumentException - If the node is not in the graph
java.lang.NullPointerException
See Also:
UndirectedGraph.getDegree(Node)

getNeighbors

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

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

getLaplacianMatrix

public int[][] getLaplacianMatrix(java.util.List nodeList)
Description copied from interface: AdvancedUndirectedGraph
Get the Laplacian matrix of a subgraph according to a given node order.

Specified by:
getLaplacianMatrix in interface AdvancedUndirectedGraph
Overrides:
getLaplacianMatrix in class AbstractGraph
Parameters:
nodeList - The list of nodes in the subgraph
Returns:
The Laplacian matrix
See Also:
AdvancedUndirectedGraph.getLaplacianMatrix(List)

getLaplacianMatrix

public int[][] getLaplacianMatrix(int[][] adjacencyMatrix)
Description copied from interface: AdvancedUndirectedGraph
Get the Laplacian matrix of a subgraph according to a given adjacency matrix.

Specified by:
getLaplacianMatrix in interface AdvancedUndirectedGraph
Overrides:
getLaplacianMatrix in class AbstractGraph
Parameters:
adjacencyMatrix - The adjacency matrix
Returns:
The Laplacian matrix
See Also:
AdvancedUndirectedGraph.getLaplacianMatrix(int[][])

getDiffusionDistanceMatrix

public double[][] getDiffusionDistanceMatrix(double beta,
                                             java.util.List nodeList)
                                      throws JSci.maths.MaximumIterationsExceededException
Description copied from interface: AdvancedUndirectedGraph
Get the diffusion distance matrix of a subgraph according to a given node order.

Specified by:
getDiffusionDistanceMatrix in interface AdvancedUndirectedGraph
Overrides:
getDiffusionDistanceMatrix in class AbstractGraph
Parameters:
beta - The diffusion parameter
nodeList - The list of nodes in the subgraph
Returns:
The diffusion distance matrix
Throws:
JSci.maths.MaximumIterationsExceededException - If the eigen problem cannot be solved in a predefined number of iterations
See Also:
AdvancedUndirectedGraph#getDiffusionDistancematrix(double, List)

getDiffusionDistanceMatrix

public double[][] getDiffusionDistanceMatrix(double beta,
                                             int[][] laplacianMatrix)
                                      throws JSci.maths.MaximumIterationsExceededException
Description copied from interface: AdvancedUndirectedGraph
Get the diffusion distance matrix of a subgraph according to a given Laplacian matrix.

Specified by:
getDiffusionDistanceMatrix in interface AdvancedUndirectedGraph
Overrides:
getDiffusionDistanceMatrix in class AbstractGraph
Parameters:
beta - The diffusion parameter
laplacianMatrix - The Laplacian matrix
Returns:
The diffusion distance matrix
Throws:
JSci.maths.MaximumIterationsExceededException - If the eigen problem cannot be solved in a predefined number of iterations
See Also:
AdvancedUndirectedGraph.getDiffusionDistanceMatrix(double, int[][])

getMaximalIndependentSets

public java.util.List getMaximalIndependentSets()
Description copied from interface: AdvancedUndirectedGraph
Get all maximal independent sets

Specified by:
getMaximalIndependentSets in interface AdvancedUndirectedGraph
Overrides:
getMaximalIndependentSets in class AbstractGraph
Returns:
A list of Node[], each containing the set of vertices in a maximal independent set
See Also:
AdvancedUndirectedGraph.getMaximalIndependentSets()

getMaximalCliques

public java.util.List getMaximalCliques()
Description copied from interface: AdvancedUndirectedGraph
Get all maximal cliques

Specified by:
getMaximalCliques in interface AdvancedUndirectedGraph
Overrides:
getMaximalCliques in class AbstractGraph
Returns:
A list of Node[], each containing the set of vertices in a maximal clique
See Also:
AdvancedUndirectedGraph.getMaximalCliques()

getDefectiveCliquesMissingEdges

public java.util.List getDefectiveCliquesMissingEdges(int k,
                                                      int l)
                                               throws java.lang.IllegalArgumentException
Description copied from interface: AdvancedUndirectedGraph
Get the missing edges in defective cliques formed by two cliques with . At least k vertices in common . At most l vertices not in common

Specified by:
getDefectiveCliquesMissingEdges in interface AdvancedUndirectedGraph
Overrides:
getDefectiveCliquesMissingEdges in class AbstractGraph
Parameters:
k - The minimum size of the overlapped clique
l - The maximum number of nodes not in the overlapping clique
Returns:
A list of Node[], each containing the two vertices of a missing edge
Throws:
java.lang.IllegalArgumentException - If the inputs are invalid
See Also:
AdvancedUndirectedGraph.getDefectiveCliquesMissingEdges(int, int)