Hi guys,

you have two easy ways to do this (the first one is easier IMHO):
1. copy Dijkstra implementation to another class (put it in the same
package and give it another name), do your changes and register it in com
.orientechnologies.orient.graph.sql.functions.OGraphFunctionFactory.
Then, in the OrientDB sources root directory and type

> ant clean install

the build process will create a distribution for you (you need Java and Ant
installed)

2. write your own function in a separate Java project, then create a .jar
file from that and copy it in the /libs directory; you also have to
register it (see
http://www.orientechnologies.com/docs/last/orientdb.wiki/SQL-Functions.html
)

Or you could just wait for this to be implemented ;-)
https://github.com/orientechnologies/orientdb/issues/1975
but it's low priority at this time, so it will probably take a few weeks.

@Rémi the trick of putting a high weight on edges to ignore is actually a
hack,
but it will work fine and I think it won't be so inefficient in the end ;-)

Luigi




2015-02-11 8:29 GMT+01:00 Rémi ALVADO <[email protected]>:

> Hi Luigi,
>
> I'm new to graph databases and I have the same question as Georg regarding
> shortestPath restricted to an edge class. I think you're right and it will
> probably spend a few hours preparing a pull request to implement this kind
> of filter in OSQLFunctionShortestPath.java
> <https://github.com/orientechnologies/orientdb/blob/develop/graphdb/src/main/java/com/orientechnologies/orient/graph/sql/functions/OSQLFunctionShortestPath.java>.
> I have the same issue Georg has : it's been a while since my last Java
> project and, even if it shouldn't be too hard to write the code, I will
> spend countless hours trying to prepare a dev environment :(
>
> But, on short term, would it be a good idea to use Dijkstra algorithm
> while playing with weights. I explain : I have a graph with User and
> Company vertices. One User can be Connected to another User, one User can
> Follow a Company and one Company can have been FoundedBy a User. So, a
> typical graph would be :
>
> User A -> Connected -> User B -> Connected -> User C -> Connected -> User
> D
>
> User A -> Follow -> Company B -> FoundedBy -> User D
>
> When I try to get the shortestPath between User A and User D, I would get
> the second path (the one using Company B). I'm using this query to help
> User A to get in touch with User D. User B and User C are real people so
> they can introduce User A to User D. Something that Company B obviously
> can't do :(
> Is it a good idea to add a "userConnectionWeight" attribute to Connected
> edges with value 0 and to Follow and FoundedBy edges with value 99999999
> so that the dijkstra algorithm would return the first path ? It seems like
> a bit of a hack, don't you think ? :(
> I'm using OrientDB 2.0.1 BTW.
> Thanks !
>
>
> On Tuesday, February 10, 2015 at 8:53:58 AM UTC+1, Luigi Dell'Aquila wrote:
>>
>> Hi Georg,
>>
>> in current implementation it's not possible. Anyway Dijkstra and
>> ShortestPath functions are quite simple (links to the source code below),
>> you could just implement your own version starting from them and (why not?)
>> send a pull request and become OrientDB contributor.
>>
>> https://github.com/orientechnologies/orientdb/
>> blob/develop/graphdb/src/main/java/com/orientechnologies/
>> orient/graph/sql/functions/OSQLFunctionShortestPath.java
>>
>>
>> https://github.com/orientechnologies/orientdb/
>> blob/develop/graphdb/src/main/java/com/orientechnologies/
>> orient/graph/sql/functions/OSQLFunctionDijkstra.java
>>
>> Thanks
>>
>> Luigi
>>
>> 2015-02-10 3:20 GMT+01:00 Georg Göttlich <[email protected]>:
>>
>>> Hello eveyone.
>>>
>>> I wanted to know if there is a way to restrict path finding
>>> (shortestPath, Dijkstra) to a certain type of Edges?
>>>
>>> If not, what would be the suggested route to integrate this (and also
>>> the dynamic weight property feature from my other post) myself?
>>>
>>> Thanks a lot.
>>>
>>> Cheers
>>> Georg
>>>
>>> --
>>>
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "OrientDB" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "OrientDB" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to