Fixes for weighted and directed graphs