Skip to content

Instantly share code, notes, and snippets.

View vevurka's full-sized avatar

Weronika Sikorska vevurka

View GitHub Profile
@vevurka
vevurka / graph.py
Last active August 7, 2019 02:36
Graph implementation using adjacency list
import unittest
class Graph(dict):
def __init__(self, vertex_list, edge_list):
for v in vertex_list:
self[v] = set()
for e in edge_list:
self.add_edge(e)
@vevurka
vevurka / matrix_graph.py
Created March 23, 2017 23:01
Matrix implementation of graph using list and dict.
import unittest
class ListGraph(object):
def __init__(self, number_of_vertices):
self.number_of_vertices = number_of_vertices
self.matrix = [[0] * number_of_vertices for _ in range(number_of_vertices)]
def add_edge(self, v1, v2):
self.matrix[v1][v2] = 1
@vevurka
vevurka / ranomd_stuff.ipynb
Created April 2, 2018 12:02
Random stuff with pandas
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.