addEdgeByNames :: String -> String -> Weight -> Graph -> Graph
addEdgeByNames f t w g = case findEdgeFromNames f t g of
    Nothing -> Graph (nodes g) (newEdge : (edges g))
    _       -> error "edge already exists"
    where newEdge = (qedge (getIndex f g) (getIndex t g) w)

-- doesn't warn if edge doesn't exist
addEdgeByNames :: String -> String -> Weight -> Graph -> Graph
addEdgeByNames f t w g = case findEdgeFromNames f t g of
    Nothing -> Graph (nodes g) (newEdge : (edges g))
    _       -> error "edge already exists"
    where newEdge = (qedge (getIndex f g) (getIndex t g) w)

-- doesn't warn if edge doesn't exist
addEdgeByNames f t w g = case findEdgeFromNames f t g of
    Nothing -> Graph (nodes g) (newEdge : (edges g))
    _       -> error "edge already exists"
    where newEdge = (qedge (getIndex f g) (getIndex t g) w)

-- doesn't warn if edge doesn't exist