Package org.testng.internal
Class DynamicGraph.Edges<T>
java.lang.Object
org.testng.internal.DynamicGraph.Edges<T>
- Enclosing class:
- DynamicGraph<T>
Manage edges and weights between nodes.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
private static <T> void
addEdgeToMap
(Map<T, Map<T, Integer>> map, T n1, T n2, int weight) (package private) void
appendDotEdges
(StringBuilder sb, Set<T> finished) private Integer
findReversedEdge
(T from, T to) Return the weight of the edge in the graph that is the reversed direction of edge.getEdges()
Allow raw access to the edges, but protect inside unmodifiableMaps.(package private) int
getLowestEdgeWeight
(Set<T> nodes) (package private) boolean
hasAllEdgesWithWeight
(T node, int level) private static <T> void
removeEdgesFromMap
(Map<T, Map<T, Integer>> map, Collection<T> nodes, T node) Remove edges from a map given a node and a list of destination nodes.(package private) void
removeNode
(T node) Remove a node from the graph and all associated edges.toString()
-
Field Details
-
m_incomingEdges
-
m_outgoingEdges
-
-
Constructor Details
-
Edges
private Edges()
-
-
Method Details
-
addEdge
-
fromNodes
- Returns:
- the set of nodes that have outgoing edges.
-
from
-
to
-
findReversedEdge
Return the weight of the edge in the graph that is the reversed direction of edge. For example, if edge a -> b exists, and edge b -> a is passed in, then return a -> b.- Parameters:
from
- - the from edgeto
- - the to edge- Returns:
- the weight of the reversed edge or null if edge does not exist
-
removeNode
Remove a node from the graph and all associated edges. Each edge needs to be removed from both maps to keep the maps in sync.- Parameters:
node
- Node to remove.
-
getLowestEdgeWeight
-
hasAllEdgesWithWeight
-
removeEdgesFromMap
Remove edges from a map given a node and a list of destination nodes. Given:
Then, calling this method to remove node c on both maps as done in removeNode(), would result in a -> c and c -> a edges being removed.m_outgoingEdges: a -> b c d m_incomingEdges: b -> a c -> a d -> a
-
addEdgeToMap
-
getEdges
Allow raw access to the edges, but protect inside unmodifiableMaps. This is for tests, toString and toDot. -
toString
-
appendDotEdges
-