views:

108

answers:

2

I have a large graph that I am processing using JUNG. I was wondering if there JUNG provides a way to extract say a 2-hop neighborhood of a vertex (complete with all edges amongst themselves) into a separate graph?

A: 

Try edu.uci.ics.jung.algorithms.connectivity.KNeighborhoodExtractor

d.lam
A: 

In JUNG 2.0 it is 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. * * @author Danyel Fisher */

Christoph