Class KNeighborhoodFilter<V,E>
- java.lang.Object
-
- edu.uci.ics.jung.algorithms.filters.KNeighborhoodFilter<V,E>
-
- All Implemented Interfaces:
com.google.common.base.Function<Graph<V,E>,Graph<V,E>>
,Filter<V,E>
,java.util.function.Function<Graph<V,E>,Graph<V,E>>
public class KNeighborhoodFilter<V,E> extends java.lang.Object implements Filter<V,E>
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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
KNeighborhoodFilter.EdgeType
The type of edge to follow for defining the neighborhood.
-
Field Summary
Fields Modifier and Type Field Description private KNeighborhoodFilter.EdgeType
edgeType
private int
radiusK
private java.util.Set<V>
rootNodes
-
Constructor Summary
Constructors Constructor Description KNeighborhoodFilter(java.util.Set<V> rootNodes, int radiusK, KNeighborhoodFilter.EdgeType edgeType)
Constructs a new instance of the filter.KNeighborhoodFilter(V rootNode, int radiusK, KNeighborhoodFilter.EdgeType edgeType)
Constructs a new instance of the filter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Graph<V,E>
apply(Graph<V,E> graph)
Constructs an unassembled graph containing the k-neighborhood around the root node(s).
-
-
-
Field Detail
-
rootNodes
private java.util.Set<V> rootNodes
-
radiusK
private int radiusK
-
edgeType
private KNeighborhoodFilter.EdgeType edgeType
-
-
Constructor Detail
-
KNeighborhoodFilter
public KNeighborhoodFilter(java.util.Set<V> rootNodes, int radiusK, KNeighborhoodFilter.EdgeType edgeType)
Constructs a new instance of the filter.- Parameters:
rootNodes
- the set of root nodesradiusK
- the neighborhood radius around the root setedgeType
- 0 for in/out edges, 1 for in-edges, 2 for out-edges
-
KNeighborhoodFilter
public KNeighborhoodFilter(V rootNode, int radiusK, KNeighborhoodFilter.EdgeType edgeType)
Constructs a new instance of the filter.- Parameters:
rootNode
- the root noderadiusK
- the neighborhood radius around the root setedgeType
- 0 for in/out edges, 1 for in-edges, 2 for out-edges
-
-