コード例 #1
0
ファイル: adjmatrix.hpp プロジェクト: mariokonrad/graph
	/// \{
	/// 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;
	}
コード例 #2
0
ファイル: adjmatrix.hpp プロジェクト: mariokonrad/graph
	/// \{
	/// 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;
	}