Skip to content

Instantly share code, notes, and snippets.

@zaksamalik
zaksamalik / README.md
Created April 9, 2023 23:31 — forked from Neilos/README.md
Bi-directional hierarchical sankey diagram

This is a demonstration of a bi-directional hierarchical sankey diagram produced in javascript, html and css using d3. (Refresh page to generate new random data)

Sankey diagrams represent flows between nodes by varying the thickness of the connecting links.

This diagram was based off of Mike Bostock's sankey diagram, but additionally incorporates bi-directionality into the flow and caters for hierarchical relationships between nodes to allow drill down into the data.

All javascript code to generate the diagram markup is contained in the app.js file, but the underlying calculations are performed using a custom plugin: bihisankey.js.

@zaksamalik
zaksamalik / karger_min_cut_adjacency_list.py
Last active March 11, 2024 02:04
Karger Algorithm to Find Min Cut Using Adjacency List
from os.path import expanduser
import random
import time
import numpy as np
def swap_converged_nodes(adjacency_list, node, converged_node, vertex):
""" Replace converged node with vertex (i.e. super node) in all adjacency list entries after converging.
Args:
@zaksamalik
zaksamalik / pdfTextMiner.py
Created March 12, 2018 01:40 — forked from vinovator/pdfTextMiner.py
A sample code which uses pdfminer module to extract text from pdf files
# pdfTextMiner.py
# Python 2.7.6
# For Python 3.x use pdfminer3k module
# This link has useful information on components of the program
# https://euske.github.io/pdfminer/programming.html
# http://denis.papathanasiou.org/posts/2010.08.04.post.html
''' Important classes to remember
PDFParser - fetches data from pdf file