Re: [jgrapht-users] DirectedNeighborIndex
Brought to you by:
barak_naveh,
perfecthash
From: John V. S. <js...@gm...> - 2009-05-06 18:09:51
|
Claudio Martella wrote: > I'm implementing a few algorithms that make extensive use of local > neighborhoods of Vertexes. Therefore I'd like to use > DirectedNeighborIndex class to speed up the computation. At the moment > I've extended SimpleDirectedWeightedGraph and added the methods > outgoingVertexesOf(V) and incomingVertexesOf(V), both cycling over the > results of outgoingEdgesOf() and incomingEdgesOf(). What I'm trying to > understand is re-implementing these outgoingVertexesOf() and > incomingVertexesOf() with calls to predecessorOf() and successorOf() > of DirectedNeighborhorIndex is the smartest way to optimize my code. > My second question, connected to the first one, is if it's possible, > if it's not already been used, to ask the graph to cache the calls > internally for some computation. I don't understand. The DirectedNeighborIndex javadoc explains that you are supposed to create the index and then add it as a listener to the graph; you don't need to modify the graph itself. The caching already happens inside of DirectedNeighborIndex. JVS |