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 (t:Tournament) | |
| WHERE t.name = "Roland Garros" and t.type = "wta" | |
| WITH t | |
| ORDER BY t.year | |
| WITH COLLECT(t) AS tournaments | |
| CALL apoc.nodes.link(tournaments, "NEXT_TOURNAMENT"); | |
| MATCH (t:Tournament) | |
| WHERE t.name = "US Open" and t.type = "wta" | |
| WITH t | 
  
    
      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
    
  
  
    
  | CALL apoc.periodic.iterate(" | |
| LOAD CSV WITH HEADERS FROM 'https://raw.githubusercontent.com/iamvarol/blogposts/main/medium/tennis/data.csv' AS row | |
| WITH row, split(row.score, ' ') AS matchSets | |
| WITH *, size(matchSets) AS setSize, | |
| row.tourney_name + '_' + row.tourney_year + '_' + 'WTA' AS tournament_id, | |
| row.tourney_name + '_' + row.tourney_year + '_' + 'WTA' + '_' + row.match_num AS matchId | |
| RETURN * | |
| " | |
| , | |
| " | 
  
    
      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 (source:Node {id: 'INET_N_856'}), (target:Node {id: 'NutsCons_1003'}) | |
| CALL gds.shortestPath.dijkstra.stream('routes-weighted', { | |
| sourceNode: source, | |
| targetNode: target, | |
| relationshipWeightProperty: 'length_km' | |
| }) | |
| YIELD index, sourceNode, targetNode, totalCost, nodeIds, costs, path | |
| RETURN | |
| index, | |
| gds.util.asNode(sourceNode).id AS sourceNodeName, | 
  
    
      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
    
  
  
    
  | CALL gds.graph.project( | |
| 'routes-weighted', | |
| 'Node', | |
| 'PIPE', | |
| { | |
| relationshipProperties: 'length_km' | |
| } | |
| ) | 
  
    
      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
    
  
  
    
  | CALL gds.louvain.stream('pipes') | |
| YIELD nodeId, communityId | |
| RETURN | |
| communityId, | |
| SIZE(COLLECT(gds.util.asNode(nodeId).id)) AS number_of_nodes, | |
| COLLECT(gds.util.asNode(nodeId).id) AS ids, | |
| COLLECT(gds.util.asNode(nodeId).country_code) AS country_codes | |
| ORDER BY number_of_nodes DESC, communityId; | 
  
    
      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
    
  
  
    
  | CALL gds.graph.project('betweennessPipes', 'Node', 'PIPE') | 
  
    
      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
    
  
  
    
  | CALL gds.betweenness.stream('betweennessPipes') | |
| YIELD nodeId, score | |
| RETURN gds.util.asNode(nodeId).id AS id, round(score,2) as score | |
| ORDER BY score DESC, id ASC | |
| LIMIT 10 | 
  
    
      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
    
  
  
    
  | CALL gds.degree.stream('degreeCentralityPipes') | |
| YIELD nodeId, score | |
| RETURN gds.util.asNode(nodeId).id AS id, score AS degree | |
| ORDER BY degree DESC, id ASC | |
| LIMIT 10 | 
  
    
      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
    
  
  
    
  | CALL gds.graph.project( | |
| 'degreeCentralityPipes', | |
| 'Node', | |
| { | |
| PIPE: { | |
| orientation: "UNDIRECTED" | |
| } | |
| } | |
| ) | 
  
    
      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 (n:Node)<-[r:PIPE]-(:Node) | |
| RETURN n.id AS id, n.country_code AS countryCode, round(n.pagerank,2) AS pagerank, round(sum(r.max_cap_M_m3_per_d),2) as maximumAnnualGasVolume | |
| ORDER BY pagerank DESC, id ASC | |
| LIMIT 10 |