T - 节点类型public class Graph<T> extends SetValueMap<T,T>
Map,本质上是基于SetValueMap实现的邻接表DEFAULT_COLLECTION_INITIAL_CAPACITYDEFAULT_INITIAL_CAPACITY, DEFAULT_LOAD_FACTOR| Constructor and Description |
|---|
Graph() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsAssociation(T target1,
T target2)
两节点是否存在直接或间接的关联
|
boolean |
containsEdge(T target1,
T target2)
是否存在边
|
Collection<T> |
getAdjacentPoints(T target)
获取节点的邻接节点
|
Collection<T> |
getAssociatedPoints(T target,
boolean includeTarget)
按广度优先,获得节点的所有直接或间接关联的节点,节点默认按添加顺序排序
|
void |
putEdge(T target1,
T target2)
添加边
|
void |
removeEdge(T target1,
T target2)
移除边
|
void |
removePoint(T target)
移除节点,并删除该节点与其他节点之间连成的边
|
createCollectionfilterAllValues, putAllValues, putValue, removeAllValues, removeValue, replaceAllValuesclear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, getRaw, hashCode, isEmpty, iterator, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, toString, valuesfinalize, getClass, notify, notifyAll, wait, wait, waitallForEach, allValues, filterAllValues, getValue, getValues, put, putAll, putAllValues, putValues, removeValues, replaceAllValues, sizeclear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, putIfAbsent, remove, remove, replace, replace, replaceAll, size, valuesforEach, spliteratorpublic boolean containsEdge(T target1, T target2)
target1 - 节点target2 - 节点public void removePoint(T target)
target - 目标对象public boolean containsAssociation(T target1, T target2)
target1 - 节点target2 - 节点public Collection<T> getAssociatedPoints(T target, boolean includeTarget)
target - 节点includeTarget - 是否包含查询节点public Collection<T> getAdjacentPoints(T target)
target - 节点Copyright © 2025. All rights reserved.