private static class DynamicGraph.Edges<T>
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.util.Map<T,java.util.Map<T,java.lang.Integer>> |
m_incomingEdges |
private java.util.Map<T,java.util.Map<T,java.lang.Integer>> |
m_outgoingEdges |
Modifier | Constructor and Description |
---|---|
private |
Edges() |
Modifier and Type | Method and Description |
---|---|
void |
addEdge(int weight,
T from,
T to,
boolean ignoreCycles) |
private static <T> void |
addEdgeToMap(java.util.Map<T,java.util.Map<T,java.lang.Integer>> map,
T n1,
T n2,
int weight) |
(package private) void |
appendDotEdges(java.lang.StringBuilder sb,
java.util.Set<T> finished) |
private java.lang.Integer |
findReversedEdge(T from,
T to)
Return the weight of the edge in the graph that is the reversed direction of edge.
|
(package private) java.util.Map<T,java.lang.Integer> |
from(T node) |
(package private) java.util.Set<T> |
fromNodes() |
(package private) java.util.Map<T,java.util.Map<T,java.lang.Integer>> |
getEdges()
Allow raw access to the edges, but protect inside unmodifiableMaps.
|
(package private) int |
getLowestEdgeWeight(java.util.Set<T> nodes) |
(package private) boolean |
hasAllEdgesWithWeight(T node,
int level) |
private static <T> void |
removeEdgesFromMap(java.util.Map<T,java.util.Map<T,java.lang.Integer>> map,
java.util.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.
|
(package private) java.util.Map<T,java.lang.Integer> |
to(T node) |
java.lang.String |
toString() |
java.util.Set<T> fromNodes()
private java.lang.Integer findReversedEdge(T from, T to)
from
- - the from edgeto
- - the to edgevoid removeNode(T node)
node
- Node to remove.int getLowestEdgeWeight(java.util.Set<T> nodes)
boolean hasAllEdgesWithWeight(T node, int level)
private static <T> void removeEdgesFromMap(java.util.Map<T,java.util.Map<T,java.lang.Integer>> map, java.util.Collection<T> nodes, T node)
m_outgoingEdges:
a -> b
c
d
m_incomingEdges:
b -> a
c -> a
d -> a
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.private static <T> void addEdgeToMap(java.util.Map<T,java.util.Map<T,java.lang.Integer>> map, T n1, T n2, int weight)
java.util.Map<T,java.util.Map<T,java.lang.Integer>> getEdges()
public java.lang.String toString()
toString
in class java.lang.Object
void appendDotEdges(java.lang.StringBuilder sb, java.util.Set<T> finished)