Re: [jgrapht-developers] obtaining neighbor sets
Brought to you by:
barak_naveh,
perfecthash
From: John V. S. <js...@gm...> - 2005-12-13 06:20:44
|
On Mon, 2005-12-12 at 14:37 -0500, Charles Fry wrote: > John suggested that this be implemented as a GraphListener. I thought it > could be named NeighborListener or something like that. The static Perhaps org._3pq.jgrapht.alg.NeighborIndex, since the listening part is just an implementation detail; the purpose is to maintain an efficient index structure for answering queries. > method could match that from GraphHelper except that for efficiency I > would have liked it to return a Set instead of a List: > > Set neighborListOf(Graph g, Object vertex); So neighborsOf instead of neighborListOf, right? Be careful about the multigraph case, where removing an edge doesn't necessarily imply removing a neighbor. > Would I want two different classes, one for undirected graphs, and one > for directed graphs (predecessorListOf and successorListOf)? For ConnectivityInspector, what we did was: - ConnectivityInspector calculates connectivity information without regard for edge direction; so if you give it a directed graph, it inspects an undirected view - StrongConnectivityInspector calculates connectivity information taking edge direction into account; you can't give it an undirected graph So in your case, maybe NeighborIndex and DirectedNeighborIndex? JVS |