Skip to content

Instantly share code, notes, and snippets.

@shoke
shoke / colorgraph.py
Created May 16, 2011 07:20
Graphene
import networkx as nx
import matplotlib as mat
import matplotlib.pyplot as plt
import numpy as np
# Colors each node in the given graph based on the data
# Set provided
def color_graph(graph, d, cmap):
col_graph = nx.Graph()
@shoke
shoke / Armchair.py
Created May 13, 2011 01:58
Hexagon/Armchair Lines
import networkx as nx
import sys
g = nx.Graph()
for i in range(6):
g.add_node(i+1)
if (i+1) > 1:
g.add_edge(i+1,i)