Skip to content

Instantly share code, notes, and snippets.

View nicolewhite's full-sized avatar

Nicole White nicolewhite

View GitHub Profile
// Unzip the data-csv.zip file and rename the folder to import.
// Move the import folder into your Neo4j directory.
// $ bin/neo4j start
// $ bin/neo4j-shell < panama_import.cypher
// Delete character at line 31362, position 82 in Addresses.csv before continuing.
// There is an escaped quote; the backslash needs to be removed.
CREATE CONSTRAINT ON (n:Address) ASSERT n.node_id IS UNIQUE;
CREATE CONSTRAINT ON (n:Officer) ASSERT n.node_id IS UNIQUE;

Project Management

In my optimization class last semester we briefly talked about project management, where there is a set of activities with given durations and some activities need to be completed before other activities can begin. We were taught to explore the management of the project’s timeline in Excel, which was tedious and prone to errors due to its manual process.


Movie Recommendations with k-Nearest Neighbors and Cosine Similarity


Introduction

The k-nearest neighbors (k-NN) algorithm is among the simplest algorithms in the data mining field. Distances / similarities are calculated between each element in the data set using some distance / similarity metric ^[1]^ that the researcher chooses (there are many distance / similarity metrics), where the distance / similarity between any two elements is calculated based on the two elements' attributes. A data element’s k-NN are the k closest data elements according to this distance / similarity.


1. A distance metric measures distance; the higher the distance the further apart the neighbors. A similarity metric measures similarity; the higher the similarity the closer the neighbors.

Markov Chains

A while back I wrote a blog post explaining Markov chains and demonstrating different ways of finding their steady-state distribution in R. Now, I want to play with Markov chains as a graph. I’m going to pull examples from around the internet and answer the same questions in Cypher as the authors do with matrices. This gives me the opportunity to explore more advanced Cypher queries while working with a topic I enjoy very much (stochastic processes and Markov chains). So this is officially just for funsies.

I found three Markov chains online that I’m going to showcase, and they involve the following topics:

Identifying Arbitrage Opportunities with Graphs


Introduction

Pokémon X & Y


Inspiration

US Flights & Airports: Delays, Cancellations, & Diversions


Table of Contents

@nicolewhite
nicolewhite / presentations.md
Last active January 22, 2017 17:43
Neo4j Presentations
@nicolewhite
nicolewhite / terran.cypher
Created November 25, 2015 13:58
Terran build tree in Neo4j
CREATE (depot:Building {name:"Supply Depot", minerals:100, gas:0}),
(command:Building {name:"Command Center", minerals:400, gas:0}),
(orbital:Building {name:"Orbital Command", minerals:150, gas:0}),
(planetary:Building {name:"Planetary Fortress", minerals:150, gas:150}),
(barracks:Building {name:"Barracks", minerals:150, gas:0}),
(ebay:Building {name:"Engineering Bay", minerals:125, gas:0}),
(turret:Building {name:"Missile Turret", minerals:100, gas:0}),
(sensor:Building {name:"Sensor Tower", minerals:125, gas:100}),
(refinery:Building {name:"Refinery", minerals:75}),
(factory:Building {name:"Factory", minerals:150, gas:100}),
@nicolewhite
nicolewhite / northwind.markdown
Last active January 25, 2023 07:55
MySQL to Neo4j

From SQL to Neo4j: Northwind

SQL Model

Neo4j Model

Get the SQL Dump

The SQL dump was stolen from here and imported into MySQL.