Skip to content

Instantly share code, notes, and snippets.

View yfarjoun's full-sized avatar

Yossi Farjoun yfarjoun

View GitHub Profile
@yfarjoun
yfarjoun / maximal_cliques.py
Created August 21, 2018 03:12 — forked from abhin4v/maximal_cliques.py
Finds all maximal cliques in a graph using the Bron-Kerbosch algorithm
# Finds all maximal cliques in a graph using the Bron-Kerbosch algorithm. The input graph here is
# in the adjacency list format, a dict with vertexes as keys and lists of their neighbors as values.
# https://en.wikipedia.org/wiki/Bron-Kerbosch_algorithm
from collections import defaultdict
def find_cliques(graph):
p = set(graph.keys())
r = set()
x = set()
@yfarjoun
yfarjoun / coord_cartesian_panels.R
Created December 4, 2022 18:23 — forked from r2evans/coord_cartesian_panels.R
per-facet panel range clipping
#' Cartesian coordinates per facet-panel
#'
#' This function mimics the behavior of [ggplot2::coord_cartesian()],
#' while supporting per-panel limits when faceted.
#'
#' @details
#'
#' A 'panel_limits' data frame may contain:
#'
#' - zero or more faceting variables, all of which must be found