删除图 - DeleteGraph
函数简介
删除指定的图对象,释放相关的内存资源。
接口名称
DeleteGraph
DLL调用
int32_t DeleteGraph(int64_t instance, int64_t graphPtr);
参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| instance | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| graphPtr | 长整数型 | 图的指针,由 CreateGraph 接口返回 |
示例
// 创建OLA实例
int64_t instance = CreateCOLAPlugInterFace();
// 创建图
int64_t graphPtr = CreateGraph(instance, "");
// 添加一些边
AddEdge(instance, graphPtr, "A", "B", 1.0, false);
AddEdge(instance, graphPtr, "B", "C", 2.0, false);
// 删除图
int32_t result = DeleteGraph(instance, graphPtr);
// 释放OLA实例
DestroyCOLAPlugInterFace(instance);
返回值
1 成功,0 失败。
注意事项
- 删除操作会释放图对象占用的所有内存资源。
- 删除后不能再使用该图指针进行任何操作。
- 删除操作不可逆,请确保不再需要该图对象。
