Implement edge-weighted digraph