/// \{ /// Removes an edge from the matrix. /// /// Complexity: O(1) /// /// \param[in] e Edge to remove /// \param[in] type Type of edge to add /// \return true on success, false otherwise /// /// \note This function performs boundary check. bool remove(edge e, edge::type type = edge::type::uni) { if ((e.from >= n) || (e.to >= n)) return false; at(e) = no_value; if (type == edge::type::bi) at(e.reverse()) = no_value; return true; }
/// \{ /// Adds an edge to the matrix. /// /// Complexity: O(1) /// /// \param[in] e The edge to add /// \param[in] type Type of edge to add /// \param[in] value Value for the specified edge /// \return true on success, false otherwise /// /// \note This function performs boundary check. bool add(edge e, edge::type type = edge::type::uni, value_type value = edge_value) { if ((e.from >= n) || (e.to >= n)) return false; at(e) = value; if (type == edge::type::bi) at(e.reverse()) = value; return true; }