[Neo4j] Neo4j default Movie database centrality algorithms

2019-01-30 Thread andrea . balzoni
I'm failry new to neo4j and i need to be pointed in the right direction. I 
was playing with the movie database that comes by default with the neo4j 
installation and i was trying to calculate the importance of each movie 
based on the actors that acted in them and their importance (the more 
movies said actor has acted in, the more important the actor is and the 
more he contributes to the movie importance).

Since i need some kind of iterative algorithm and since the eigenvector 
centrality is missing from neo4j, i was thinking about using pageRank 
algorithm. What would be the best approach in this scenario to use this 
algorithm? I'm a bit lost and googling around has brought me nowhere, any 
help would be appreciated. Thanks for reading and sorry for my english.

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


Re: [Neo4j] Neo4j Default Movie Database

2019-01-17 Thread 'Michael Hunger' via Neo4j
You've probably seen the documentation:
https://neo4j.com/docs/graph-algorithms/current/algorithms/centrality/

the code is here:
https://github.com/neo4j-contrib/neo4j-graph-algorithms/tree/3.4/algo/src/main/java/org/neo4j/graphalgo

Michael

Join our new Community Site & Forum 


On Thu, Jan 17, 2019 at 2:43 PM Andrea Balzoni 
wrote:

> Thanks again for precious help! Ultimately, could you please point me
> towards some material or code examples (virtual or not) that would allow me
> to obtain a better grasp of neo4j's centrality algorithms and, in
> particular, projections?
>
> Thanks again
>
> Andrea
>
> Il giorno gio 17 gen 2019 alle ore 13:52 'Michael Hunger' via Neo4j <
> neo4j@googlegroups.com> ha scritto:
>
>> Cool that it worked for you.
>>
>> For more iterative approaches it could work just to run it multiple times
>> and add e.g. `(m.pageRank + n.pageRank)/2` to the weight.
>>
>> Otherwise one would have to provide an option for "dynamic" weight
>> computation in the library.
>>
>> We plan to make the library more extensible and dynamic in 2019 probably
>> not in the very near future though as we work on some other topics.
>>
>> Join our new Community Site & Forum 
>>
>>
>> On Thu, Jan 17, 2019 at 1:24 PM Andrea Balzoni <
>> andrea.balz...@keypartner.it> wrote:
>>
>>> Hi, thanks for your answer. I tried running your code this :
>>>
>>> call algo.pageRank.stream(
>>> 'MATCH (m:Movie) RETURN id(m) as id',
>>> 'MATCH (m:Movie)<-[:ACTED_IN]-(p:Person)-[:ACTED_IN]->(n:Movie)
>>> RETURN id(m) as source, id(n) as target, size( (p)-[:ACTED_IN]->() ) as
>>> weight',
>>> {graph:'cypher',weightProperty: 'weight'})
>>> YIELD node, score WITH node, score
>>> ORDER BY score DESC LIMIT 200
>>> RETURN node.title as movie, score
>>>
>>> with a small correction where i replaced "m" with "n" in "id(n) as
>>> target" and it worked just fine. The follow-up question would be: is there
>>> a way to make this more "iterative"? Instead of using the actors' degree,
>>> is there a way to make it "more iterative" and, instead of giving to every
>>> movie the same importance towards the actors' degree, take into account the
>>> movies' importance aswell and make them weight more or less according to
>>> that? Thanks again!
>>>
>>> Andrea
>>>
>>> Il giorno gio 17 gen 2019 alle ore 12:25 'Michael Hunger' via Neo4j <
>>> neo4j@googlegroups.com> ha scritto:
>>>
 I guess based on your description, the a projection like this would
 make most sense. Using the actor's degree as weight for page-rank

 call algo.pageRank.stream('
 MATCH (m:Movie) RETURN id(m) as id
 ','
 MATCH (m:Movie)<-[:ACTED_IN]-(p:Person)-[:ACTED_IN]->(n:Movie)
 RETURN id(m) as source, id(m) as target, size( (p)-[:ACTED_IN]->() ) as
 weight
 ', {graph:'cypher',weightProperty: 'weight'})

 Cheers, Michael

 Join our new Community Site & Forum 


 On Thu, Jan 17, 2019 at 11:55 AM  wrote:

> Hi, i'm failry new to neo4j and i was playing around with the movie
> database that comes by default when installing neo4j. I would like to
> calculate the importance of each movie based on the actors that acted in
> them considering each actor more or less important according to the number
> of movies they acted in. I was thinking about some kind of iterative
> algorithm and since the eigenvector centrality is missing from neo4j i was
> looking at pageRank.
>
> What would be the best approach in this scenario to use pageRank
> correctly? I'm a bit lost and googling around didn't help much as what i'm
> looking for seems more specific than the average info you can find online.
> Thanks for reading and sorry for my bad english.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Neo4j" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to neo4j+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
 --
 You received this message because you are subscribed to the Google
 Groups "Neo4j" group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to neo4j+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

>>>
>>>
>>> --
>>> *Andrea Balzoni  |  **Consultant*
>>>
>>> *Roma*,
>>> 
>>>
>>> Via
>>> F. Cangiullo, 24 - *Milano*, Via Aosta, 4
>>> Office: +39 06.5922216 | Mobile: +39 333741162X
>>> Mail: andrea.balz...@keypartner.it 
>>>
>>>
>>> Visit our new website www.KeyPartner.com 
>>>
>>> --
>>> You received this message because you are subscribed to

Re: [Neo4j] Neo4j Default Movie Database

2019-01-17 Thread Andrea Balzoni
Thanks again for precious help! Ultimately, could you please point me
towards some material or code examples (virtual or not) that would allow me
to obtain a better grasp of neo4j's centrality algorithms and, in
particular, projections?

Thanks again

Andrea

Il giorno gio 17 gen 2019 alle ore 13:52 'Michael Hunger' via Neo4j <
neo4j@googlegroups.com> ha scritto:

> Cool that it worked for you.
>
> For more iterative approaches it could work just to run it multiple times
> and add e.g. `(m.pageRank + n.pageRank)/2` to the weight.
>
> Otherwise one would have to provide an option for "dynamic" weight
> computation in the library.
>
> We plan to make the library more extensible and dynamic in 2019 probably
> not in the very near future though as we work on some other topics.
>
> Join our new Community Site & Forum 
>
>
> On Thu, Jan 17, 2019 at 1:24 PM Andrea Balzoni <
> andrea.balz...@keypartner.it> wrote:
>
>> Hi, thanks for your answer. I tried running your code this :
>>
>> call algo.pageRank.stream(
>> 'MATCH (m:Movie) RETURN id(m) as id',
>> 'MATCH (m:Movie)<-[:ACTED_IN]-(p:Person)-[:ACTED_IN]->(n:Movie)
>> RETURN id(m) as source, id(n) as target, size( (p)-[:ACTED_IN]->() ) as
>> weight',
>> {graph:'cypher',weightProperty: 'weight'})
>> YIELD node, score WITH node, score
>> ORDER BY score DESC LIMIT 200
>> RETURN node.title as movie, score
>>
>> with a small correction where i replaced "m" with "n" in "id(n) as
>> target" and it worked just fine. The follow-up question would be: is there
>> a way to make this more "iterative"? Instead of using the actors' degree,
>> is there a way to make it "more iterative" and, instead of giving to every
>> movie the same importance towards the actors' degree, take into account the
>> movies' importance aswell and make them weight more or less according to
>> that? Thanks again!
>>
>> Andrea
>>
>> Il giorno gio 17 gen 2019 alle ore 12:25 'Michael Hunger' via Neo4j <
>> neo4j@googlegroups.com> ha scritto:
>>
>>> I guess based on your description, the a projection like this would make
>>> most sense. Using the actor's degree as weight for page-rank
>>>
>>> call algo.pageRank.stream('
>>> MATCH (m:Movie) RETURN id(m) as id
>>> ','
>>> MATCH (m:Movie)<-[:ACTED_IN]-(p:Person)-[:ACTED_IN]->(n:Movie)
>>> RETURN id(m) as source, id(m) as target, size( (p)-[:ACTED_IN]->() ) as
>>> weight
>>> ', {graph:'cypher',weightProperty: 'weight'})
>>>
>>> Cheers, Michael
>>>
>>> Join our new Community Site & Forum 
>>>
>>>
>>> On Thu, Jan 17, 2019 at 11:55 AM  wrote:
>>>
 Hi, i'm failry new to neo4j and i was playing around with the movie
 database that comes by default when installing neo4j. I would like to
 calculate the importance of each movie based on the actors that acted in
 them considering each actor more or less important according to the number
 of movies they acted in. I was thinking about some kind of iterative
 algorithm and since the eigenvector centrality is missing from neo4j i was
 looking at pageRank.

 What would be the best approach in this scenario to use pageRank
 correctly? I'm a bit lost and googling around didn't help much as what i'm
 looking for seems more specific than the average info you can find online.
 Thanks for reading and sorry for my bad english.

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

>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Neo4j" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to neo4j+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>> --
>> *Andrea Balzoni  |  **Consultant*
>>
>> *Roma*,
>> 
>>
>> Via
>> F. Cangiullo, 24 - *Milano*, Via Aosta, 4
>> Office: +39 06.5922216 | Mobile: +39 333741162X
>> Mail: andrea.balz...@keypartner.it 
>>
>>
>> Visit our new website www.KeyPartner.com 
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Neo4j" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to neo4j+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Neo4j" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to neo4j+unsubscr...@googlegroups.com.
> For more options, visit https://groups.goo

Re: [Neo4j] Neo4j Default Movie Database

2019-01-17 Thread 'Michael Hunger' via Neo4j
Cool that it worked for you.

For more iterative approaches it could work just to run it multiple times
and add e.g. `(m.pageRank + n.pageRank)/2` to the weight.

Otherwise one would have to provide an option for "dynamic" weight
computation in the library.

We plan to make the library more extensible and dynamic in 2019 probably
not in the very near future though as we work on some other topics.

Join our new Community Site & Forum 


On Thu, Jan 17, 2019 at 1:24 PM Andrea Balzoni 
wrote:

> Hi, thanks for your answer. I tried running your code this :
>
> call algo.pageRank.stream(
> 'MATCH (m:Movie) RETURN id(m) as id',
> 'MATCH (m:Movie)<-[:ACTED_IN]-(p:Person)-[:ACTED_IN]->(n:Movie)
> RETURN id(m) as source, id(n) as target, size( (p)-[:ACTED_IN]->() ) as
> weight',
> {graph:'cypher',weightProperty: 'weight'})
> YIELD node, score WITH node, score
> ORDER BY score DESC LIMIT 200
> RETURN node.title as movie, score
>
> with a small correction where i replaced "m" with "n" in "id(n) as target"
> and it worked just fine. The follow-up question would be: is there a way to
> make this more "iterative"? Instead of using the actors' degree, is there a
> way to make it "more iterative" and, instead of giving to every movie the
> same importance towards the actors' degree, take into account the movies'
> importance aswell and make them weight more or less according to that?
> Thanks again!
>
> Andrea
>
> Il giorno gio 17 gen 2019 alle ore 12:25 'Michael Hunger' via Neo4j <
> neo4j@googlegroups.com> ha scritto:
>
>> I guess based on your description, the a projection like this would make
>> most sense. Using the actor's degree as weight for page-rank
>>
>> call algo.pageRank.stream('
>> MATCH (m:Movie) RETURN id(m) as id
>> ','
>> MATCH (m:Movie)<-[:ACTED_IN]-(p:Person)-[:ACTED_IN]->(n:Movie)
>> RETURN id(m) as source, id(m) as target, size( (p)-[:ACTED_IN]->() ) as
>> weight
>> ', {graph:'cypher',weightProperty: 'weight'})
>>
>> Cheers, Michael
>>
>> Join our new Community Site & Forum 
>>
>>
>> On Thu, Jan 17, 2019 at 11:55 AM  wrote:
>>
>>> Hi, i'm failry new to neo4j and i was playing around with the movie
>>> database that comes by default when installing neo4j. I would like to
>>> calculate the importance of each movie based on the actors that acted in
>>> them considering each actor more or less important according to the number
>>> of movies they acted in. I was thinking about some kind of iterative
>>> algorithm and since the eigenvector centrality is missing from neo4j i was
>>> looking at pageRank.
>>>
>>> What would be the best approach in this scenario to use pageRank
>>> correctly? I'm a bit lost and googling around didn't help much as what i'm
>>> looking for seems more specific than the average info you can find online.
>>> Thanks for reading and sorry for my bad english.
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Neo4j" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to neo4j+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Neo4j" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to neo4j+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
> *Andrea Balzoni  |  **Consultant*
>
> *Roma*,
> 
>
> Via
> F. Cangiullo, 24 - *Milano*, Via Aosta, 4
> Office: +39 06.5922216 | Mobile: +39 333741162X
> Mail: andrea.balz...@keypartner.it 
>
>
> Visit our new website www.KeyPartner.com 
>
> --
> You received this message because you are subscribed to the Google Groups
> "Neo4j" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to neo4j+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [Neo4j] Neo4j Default Movie Database

2019-01-17 Thread Andrea Balzoni
Hi, thanks for your answer. I tried running your code this :

call algo.pageRank.stream(
'MATCH (m:Movie) RETURN id(m) as id',
'MATCH (m:Movie)<-[:ACTED_IN]-(p:Person)-[:ACTED_IN]->(n:Movie)
RETURN id(m) as source, id(n) as target, size( (p)-[:ACTED_IN]->() ) as
weight',
{graph:'cypher',weightProperty: 'weight'})
YIELD node, score WITH node, score
ORDER BY score DESC LIMIT 200
RETURN node.title as movie, score

with a small correction where i replaced "m" with "n" in "id(n) as target"
and it worked just fine. The follow-up question would be: is there a way to
make this more "iterative"? Instead of using the actors' degree, is there a
way to make it "more iterative" and, instead of giving to every movie the
same importance towards the actors' degree, take into account the movies'
importance aswell and make them weight more or less according to that?
Thanks again!

Andrea

Il giorno gio 17 gen 2019 alle ore 12:25 'Michael Hunger' via Neo4j <
neo4j@googlegroups.com> ha scritto:

> I guess based on your description, the a projection like this would make
> most sense. Using the actor's degree as weight for page-rank
>
> call algo.pageRank.stream('
> MATCH (m:Movie) RETURN id(m) as id
> ','
> MATCH (m:Movie)<-[:ACTED_IN]-(p:Person)-[:ACTED_IN]->(n:Movie)
> RETURN id(m) as source, id(m) as target, size( (p)-[:ACTED_IN]->() ) as
> weight
> ', {graph:'cypher',weightProperty: 'weight'})
>
> Cheers, Michael
>
> Join our new Community Site & Forum 
>
>
> On Thu, Jan 17, 2019 at 11:55 AM  wrote:
>
>> Hi, i'm failry new to neo4j and i was playing around with the movie
>> database that comes by default when installing neo4j. I would like to
>> calculate the importance of each movie based on the actors that acted in
>> them considering each actor more or less important according to the number
>> of movies they acted in. I was thinking about some kind of iterative
>> algorithm and since the eigenvector centrality is missing from neo4j i was
>> looking at pageRank.
>>
>> What would be the best approach in this scenario to use pageRank
>> correctly? I'm a bit lost and googling around didn't help much as what i'm
>> looking for seems more specific than the average info you can find online.
>> Thanks for reading and sorry for my bad english.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Neo4j" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to neo4j+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Neo4j" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to neo4j+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>


-- 
*Andrea Balzoni  |  **Consultant*

*Roma*,


Via
F. Cangiullo, 24 - *Milano*, Via Aosta, 4
Office: +39 06.5922216 | Mobile: +39 333741162X
Mail: andrea.balz...@keypartner.it 


Visit our new website www.KeyPartner.com 

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


Re: [Neo4j] Neo4j Default Movie Database

2019-01-17 Thread 'Michael Hunger' via Neo4j
I guess based on your description, the a projection like this would make
most sense. Using the actor's degree as weight for page-rank

call algo.pageRank.stream('
MATCH (m:Movie) RETURN id(m) as id
','
MATCH (m:Movie)<-[:ACTED_IN]-(p:Person)-[:ACTED_IN]->(n:Movie)
RETURN id(m) as source, id(m) as target, size( (p)-[:ACTED_IN]->() ) as
weight
', {graph:'cypher',weightProperty: 'weight'})

Cheers, Michael

Join our new Community Site & Forum 


On Thu, Jan 17, 2019 at 11:55 AM  wrote:

> Hi, i'm failry new to neo4j and i was playing around with the movie
> database that comes by default when installing neo4j. I would like to
> calculate the importance of each movie based on the actors that acted in
> them considering each actor more or less important according to the number
> of movies they acted in. I was thinking about some kind of iterative
> algorithm and since the eigenvector centrality is missing from neo4j i was
> looking at pageRank.
>
> What would be the best approach in this scenario to use pageRank
> correctly? I'm a bit lost and googling around didn't help much as what i'm
> looking for seems more specific than the average info you can find online.
> Thanks for reading and sorry for my bad english.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Neo4j" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to neo4j+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


[Neo4j] Neo4j Default Movie Database

2019-01-17 Thread andrea . balzoni
Hi, i'm failry new to neo4j and i was playing around with the movie 
database that comes by default when installing neo4j. I would like to 
calculate the importance of each movie based on the actors that acted in 
them considering each actor more or less important according to the number 
of movies they acted in. I was thinking about some kind of iterative 
algorithm and since the eigenvector centrality is missing from neo4j i was 
looking at pageRank.

What would be the best approach in this scenario to use pageRank correctly? 
I'm a bit lost and googling around didn't help much as what i'm looking for 
seems more specific than the average info you can find online. Thanks for 
reading and sorry for my bad english.

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