Skip to content

Instantly share code, notes, and snippets.

View jg-you's full-sized avatar
🐢

Jean-Gabriel Young jg-you

🐢
View GitHub Profile
@jg-you
jg-you / main_master_slave.cpp
Last active October 15, 2020 02:13
Master / Slave example with boost::mpi
// STL
#include <cstdlib>
#include <iostream>
// boost::mpi
#include <boost/mpi/environment.hpp>
#include <boost/mpi/communicator.hpp>
#include <boost/mpi/status.hpp>
namespace mpi = boost::mpi;
// Definitions
#define NUMBER_OF_JOBS 12
@jg-you
jg-you / draw_nx_beautiful.py
Last active October 30, 2022 00:04
Beautiful networkx graph
import copy
import networkx
import matplotlib.pyplot as plt
# Generate a graph.
# Here I chose an ER graph.
g = nx.erdos_renyi_graph(20, 0.3)
# Get positions.
# Here I use the spectral layout and add a little bit of noise.
@jg-you
jg-you / orbits.py
Last active January 23, 2023 15:23
Computing the number of orbits in a graph, with dreadnaut (nauty), in python
# -*- coding: utf-8 -*-
"""
Wrapper around dreadnaut that computes the orbits of a graph.
NOTE: Must have installed `dreandaut`. The location of the binary can be passed
as an argument to `compute_automorphisms`.
Author: Jean-Gabriel Young <info@jgyoung.ca>
"""
import subprocess