Cytoscape 2.8.0 API

cytoscape.util
Class TopologicalSort

java.lang.Object
  extended by cytoscape.util.TopologicalSort

public class TopologicalSort
extends Object

Implements topological sorting of nodes in a graph. See for example http://en.wikipedia.org/wiki/Topological_sorting (the Tarjan algorithm)


Constructor Summary
TopologicalSort()
           
 
Method Summary
static List<TopoGraphNode> sort(Collection<TopoGraphNode> nodes)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TopologicalSort

public TopologicalSort()
Method Detail

sort

public static List<TopoGraphNode> sort(Collection<TopoGraphNode> nodes)
                                throws IllegalStateException
Parameters:
nodes - the list of all nodes
edges - the edges that connect the nodes that need to be sorted.
Returns:
the topological order
Throws:
IllegalStateException - if a cycle has been detected N.B. it might be a good idea to make sure that whatever the concrete type of the nodes in "nodes" are has a toString() method that returns the name of a node since this method will be used if a cycle has been detected to report one of the nodes in the cycle.

Cytoscape 2.8.0 API

Copyright 2010 Cytoscape Consortium. All rights reserved.