Re: [jgrapht-users] get a set of neighbors
Brought to you by:
barak_naveh,
perfecthash
From: Xueyang Z. <xue...@gm...> - 2009-08-11 04:18:25
|
HI, Try the following: for(DefaultEdge e:g.edgesOf(X)){ Vertex v=g.getEdgeTarget(e); ..... } 2009/8/10 Khanh Nguyen <ngu...@gm...> > Hello all, > > I am new to JGraphT (just started this morning). I am working on a > simple random search on a graph and I need to get the set of neighbors > of each vertex. How do I do it? > > My attempt is to use edgesOf() method to get the set of edges of > vertex X, but I don't know how to go next from there, as all methods > in DefaultVertex are protected. It looks like this > > Set<DefaultEdge> s = g.edgesOf(X); > ...? > > I guess, I could also try to implement an Iterator? but it seems more > advanced at this point for me. > > Thanks. > > -k > > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day > trial. Simplify your report design, integration and deployment - and focus > on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > jgrapht-users mailing list > jgr...@li... > https://lists.sourceforge.net/lists/listinfo/jgrapht-users > |