This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Twitter API Doc: https://developer.twitter.com/en/docs/tweets/search/overview/basic-search | |
import twitter #https://python-twitter.readthedocs.io/en/latest/getting_started.html | |
import random | |
api = twitter.Api( | |
consumer_key='your_consumer_key', | |
consumer_secret='your_consumer_secret', | |
access_token_key='your_access_token_key', | |
access_token_secret='your_access_token_secret', | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from py2neo import Graph | |
from igraph import Graph as IGraph | |
graph = Graph() | |
query = ''' | |
MATCH (c1:Character)-[r:INTERACTS]->(c2:Character) | |
RETURN c1.name, c2.name, r.weight AS weight | |
''' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MATCH (c:Character) | |
WITH collect(c) AS characters | |
CALL apoc.algo.betweenness(["INTERACTS"], characters, "BOTH") YIELD node, score | |
SET node.betweenness = score | |
RETURN node.name AS name, score ORDER BY score DESC |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MATCH (users) -[:LIKES]-> (:Page {name:"The Beatles"}) | |
RETURN users |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT u.name, u.gender, u.age | |
FROM User u, Likes c, Page p | |
WHERE p.name = ”The Beatles” | |
AND p.ID = c.ID_Page | |
AND c.ID_User = u.ID |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
g.V.has("name","John").out("LIKES") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT EXPAND( BOTH(‘LIKES’) ) FROM User WHERE name=”John” |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MATCH (:User {name: “John”}) -[:LIKES]-> (pages) | |
RETURN pages |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MATCH (User {name: “John”}) -[:LIKES]-> (pages) | |
RETURN pages |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from py2neo import Graph, Node, NodeSelector | |
g = Graph(password="admin") | |
selector = NodeSelector(g) | |
john = selector.select("User", name="John").first() | |
john_likes = g.match(start_node=john, rel_type="LIKES") | |
for like in john_likes: | |
page = like.end_node() |
NewerOlder