refactor module layout; add test; add attributes to WeightedGraph