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.
// 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; |
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.
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:
Table of Contents
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}), |
The SQL dump was stolen from here and imported into MySQL.