I don't understand why you want to use Guava for graph handling, it's
for sure not a graph API. The common library I'm using in my projects is
JGraphT which is pretty nice and contains dozens of algorithms.
Lorenz
On 27.12.2017 19:10, Victor Porton wrote:
> On Wed, 2017-12-27 at 12:46 -0500, ajs6f wrote:
>> The advice given seems very clear:
>>
>>> when adding such elements to a graph, you should create them once
>>> and store the reference if you will need to refer to those elements
>>> more than once during creation
>> Use Resource myResource = model.createResource("some URI") and reuse
>> myResource as often as needed.
> I get some resources from a model. I suspect that in this case they
> would be sometimes duplicate.
>
>> What is the purpose of adding Jena resources to a Guava graph? It
>> seems plausible that you are duplicating functionality found in Jena.
> I need to check such things as whether there is a path from node A to
> node B. Or I need to relationally compose two graphs.
>
> Well, I've just discovered that Guava does not directly support such
> operations. I need another graph library with support of more complex
> operations.
>
>> ajs6f
>>
>>> On Dec 27, 2017, at 12:41 PM, Victor Porton <[email protected]>
>>> wrote:
>>>
>>> From https://github.com/google/guava/wiki/GraphsExplained :
>>>
>>> don't construct multiple elements that are equal to each other and
>>> expect them to be interchangeable. In particular, when adding such
>>> elements to a graph, you should create them once and store the
>>> reference if you will need to refer to those elements more than
>>> once
>>> during creation (rather than passing new MyMutableNode(id) to each
>>> add*() call).
>>>
>>> But I want a graph whose vertices are Resource from Jena. Because
>>> one
>>> resource may be met in a model multiple times, I expect that Jena
>>> will
>>> give me multiple instances of Resource with the same URL. What to
>>> do?
>>> How can I make a graph with Resource as vertices?
>>>
>>> Please help.
>>