在JUNG 2.0中它是
edu.uci.ics.jung.algorithms.filters.KNeighborhoodFilter:
A filter used to extract the k-neighborhood around one or more root
node(s). The k-neighborhood is defined as the subgraph induced by the
set of vertices that are k or fewer hops (unweighted shortest-path
distance) away from the root node.
这是你如何使用它(假设你已经有了图形和顶点/边缘类型):
Graph graph = // ...
int k = 3; // maximum hops
V startVertex = // ... (pick your starting node)
Filter filter = new KNeighborhoodFilter(
startVertex, k, EdgeType.IN_OUT);
Graph neighborhood = ansform(graph);
邻域图将与原始图形属于同一类.您必须为每个不同的起始节点创建一个新过滤器.
本文发布于:2024-01-30 19:42:40,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/170661496622375.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |