View tree.py
This file contains 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
# Given a binary tree, this routine computes new coordinates for visualization purposes | |
# (reduces overlap between nodes). | |
# ix (paix) should be np.arrays that have integer indices for nodes (parent nodes). | |
# paix of root should be -1. | |
# depth is a np.array with integer value of the depth, and | |
# coords is 2d initial coordinates of each node. | |
# It works as follows, as a physics simulation: | |
# - y coordinates are fixed by looking at the depth (not free). |
View HashedArray.cpp
This file contains 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
#include <iostream> | |
#include <vector> | |
#include <map> | |
#include <cmath> | |
using namespace std; | |
// Hashed array | |
template <class T> | |
class HashedArray |
View hgfc.R
This file contains 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
# Ozan Irsoy, 2013 | |
# Graph factorization. | |
# W: adjacency matrix | |
# m: # clusters (# vertices in U) | |
gfact = function(W, m) { | |
n = dim(W)[1] | |
H = matrix(runif(n*m,1,2),n,m) | |
L = diag(runif(m,1,2)) | |