Categories
Uncategorized

MySQL Node Matrix – Python

This will create either a directed or an undirected matrix on a MySQL data base. The edges are written as tuples, like this Where the first item in the tuple is the from node, the second item is the to node, and the third item is the weight of the edge. Here is the code […]

Categories
data science

Plotting an equation – R

This is how you plot an equation in R. The equation we are going to plot is a simple one. y = x– 1 The first thing we do is set the value for x by creating a sequence from 0 to 1 at 0.01 intervals Now we can get the y values so if […]

Categories
Uncategorized

Pajek to database – Python

This is how you read a pajek file and move it all to a database. This consists of three files, all in the same directory sample.txt – the pajek sample file pajek_rw.py – module that reads the pajek file g2db.py – which moves all the data to a database sample.txt This is what the pajek […]

Categories
Uncategorized

ncol2pajek – Python

I’ve just written a very short Python script that will change an ncol graph file to Pajek format. https://github.com/jose187/ncol2pajek Some info on how to use it The ncol File The format of the ncol file will normally be like this The node names should not have any spaces and they should be separated by a […]

Categories
data science

Plot for Density and Inclusiveness – R

This function will color all the nodes that are isolated in red. It will also draw the graph using the circle layout. No time to explain. Sorry. The Function

Categories
Uncategorized

Dot Graph for Directory – Python

How to create a dot graph for a directory. The Problem I wrote the dir2dot( ) python function in my previous post…but it has one massive mistake. If we have items in different folders that have the same name, the function gets all confused and freaks out. For example, if we have the following directory: […]