public class Algorithms extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Algorithms.PathWay
Represents a pathway.
|
Constructor and Description |
---|
Algorithms() |
Modifier and Type | Method and Description |
---|---|
static ArrayList<org.cytoscape.model.CyNode> |
constructNodeList(HashMap<org.cytoscape.model.CyNode,org.cytoscape.model.CyNode> previous,
org.cytoscape.model.CyNode source,
org.cytoscape.model.CyNode target)
Finds a path from a source to a sink using a supplied previous node list
|
static Algorithms.PathWay |
dijkstra(org.cytoscape.model.CyNetwork network,
Map<org.cytoscape.model.CyNode,String> cyNodeToId,
org.cytoscape.model.CyNode source,
org.cytoscape.model.CyNode target)
Computes the shortest path from a source to a sink in the supplied
network
|
static org.cytoscape.model.CyEdge |
getEdge(org.cytoscape.model.CyNetwork network,
org.cytoscape.model.CyNode source,
org.cytoscape.model.CyNode target)
Returns an edge that connects source to target if it exists, null
otherwise
|
static double |
getWeight(org.cytoscape.model.CyNetwork network,
org.cytoscape.model.CyEdge edge)
Returns the weight of an edge in the network
|
static void |
initializeHiddenEdges(Set<org.cytoscape.model.CyEdge> edges)
Initializes the set of hidden edges.
|
static ArrayList<Algorithms.PathWay> |
ksp(org.cytoscape.model.CyNetwork network,
Map<org.cytoscape.model.CyNode,String> cyNodeToId,
org.cytoscape.model.CyNode source,
org.cytoscape.model.CyNode target,
int maxK,
boolean includePathScoreTies)
Computes the k shortest acyclic paths in the supplied network using Yen's
algorithm.
|
static HashMap<org.cytoscape.model.CyNode,Double> |
reverseSingleSourceDijkstra(org.cytoscape.model.CyNetwork network,
org.cytoscape.model.CyNode source)
Computes the shortest distance from a source to every node in the graph
|
static void |
setEdgeWeights(Map<org.cytoscape.model.CyEdge,Double> weights)
Initializes our local copy of the edge weights
|
static void |
setWeight(org.cytoscape.model.CyEdge edge,
double value)
Sets the weight of an edge in the network.
|
static Algorithms.PathWay |
shortestPathAStar(org.cytoscape.model.CyNetwork network,
Map<org.cytoscape.model.CyNode,String> cyNodeToId,
org.cytoscape.model.CyNode source,
org.cytoscape.model.CyNode target,
HashMap<org.cytoscape.model.CyNode,Double> minDists)
An implementation of the A* algorithm.
|
static HashMap<org.cytoscape.model.CyNode,Double> |
singleSourceDijkstra(org.cytoscape.model.CyNetwork network,
org.cytoscape.model.CyNode source)
Computes the shortest distance from a source to every node in the graph
|
static void |
sortResult(ArrayList<Algorithms.PathWay> result)
Sort the list of the paths using its custom compareTo method
|
public static ArrayList<Algorithms.PathWay> ksp(org.cytoscape.model.CyNetwork network, Map<org.cytoscape.model.CyNode,String> cyNodeToId, org.cytoscape.model.CyNode source, org.cytoscape.model.CyNode target, int maxK, boolean includePathScoreTies)
network
- the supplied networkcyNodeToId
- the map that maps CyNode object to its string namesource
- the source nodetarget
- the target nodemaxK
- the number of shortest pathsincludePathScoreTies
- the option to include all paths of equal lengthpublic static Algorithms.PathWay shortestPathAStar(org.cytoscape.model.CyNetwork network, Map<org.cytoscape.model.CyNode,String> cyNodeToId, org.cytoscape.model.CyNode source, org.cytoscape.model.CyNode target, HashMap<org.cytoscape.model.CyNode,Double> minDists)
network
- the supplied networkcyNodeToId
- the map that maps CyNode object to its string namesource
- the source nodetarget
- the target nodeminDists
- the map of nodes to their minimum distance from the targetpublic static HashMap<org.cytoscape.model.CyNode,Double> reverseSingleSourceDijkstra(org.cytoscape.model.CyNetwork network, org.cytoscape.model.CyNode source)
network
- the supplied networksource
- the sourcepublic static HashMap<org.cytoscape.model.CyNode,Double> singleSourceDijkstra(org.cytoscape.model.CyNetwork network, org.cytoscape.model.CyNode source)
network
- the supplied networksource
- the sourcepublic static Algorithms.PathWay dijkstra(org.cytoscape.model.CyNetwork network, Map<org.cytoscape.model.CyNode,String> cyNodeToId, org.cytoscape.model.CyNode source, org.cytoscape.model.CyNode target)
network
- the networkcyNodeToId
- the map that maps CyNode object to its string namesource
- the source node of the graphtarget
- the target node of the graphpublic static void setEdgeWeights(Map<org.cytoscape.model.CyEdge,Double> weights)
weights
- a map of the edge to its valuepublic static double getWeight(org.cytoscape.model.CyNetwork network, org.cytoscape.model.CyEdge edge)
network
- the supplied networkedge
- the edge to find the weight ofpublic static void setWeight(org.cytoscape.model.CyEdge edge, double value)
edge
- the edge to set the weight ofvalue
- the new weight of the edgepublic static org.cytoscape.model.CyEdge getEdge(org.cytoscape.model.CyNetwork network, org.cytoscape.model.CyNode source, org.cytoscape.model.CyNode target)
network
- the networksource
- the source of the edgetarget
- the target of the edgepublic static ArrayList<org.cytoscape.model.CyNode> constructNodeList(HashMap<org.cytoscape.model.CyNode,org.cytoscape.model.CyNode> previous, org.cytoscape.model.CyNode source, org.cytoscape.model.CyNode target)
previous
- a map of node predecessorssource
- the source node of the graphtarget
- the target node of the graphpublic static void initializeHiddenEdges(Set<org.cytoscape.model.CyEdge> edges)
edges
- the initial hidden edgespublic static void sortResult(ArrayList<Algorithms.PathWay> result)
result
- the sorted list of pathssCopyright © 2018. All rights reserved.