修改密码

请输入密码
请输入密码 请输入8-64长度密码 和 email 地址不相同 至少包括数字、大写字母、小写字母、半角符号中的 3 个
请输入密码
提交

修改昵称

当前昵称:
提交

申请证书

证书详情

Please complete this required field.

  • Ultipa Graph V4

Standalone

Please complete this required field.

Please complete this required field.

服务器的MAC地址

Please complete this required field.

Please complete this required field.

取消
申请
ID
产品
状态
核数
申请天数
审批时间
过期时间
MAC地址
申请理由
审核信息
关闭
基础信息
  • 用户昵称:
  • 手机号:
  • 公司名称:
  • 公司邮箱:
  • 地区:
  • 语言:
修改密码
申请证书

当前未申请证书.

申请证书
Certificate Issued at Valid until Serial No. File
Serial No. Valid until File

Not having one? Apply now! >>>

ProductName CreateTime ID Price File
ProductName CreateTime ID Price File

No Invoice

v5.0
搜索
    v5.0

      Node2Vec游走

      HDC

      概述

      与经典的随机游走不同,Node2Vec游走是一种有偏的随机游走(Biased Random Walk),可以以广度优先(BFS)或深度优先(DFS)的方式探索节点邻域。详情请参考Node2Vec算法。

      特殊说明

      • 节点可以沿自环边游走。
      • Node2Vec游走的结果与边的方向无关。

      示例图集

      创建示例图集:

      // 在空图集中逐行运行以下语句
      create().edge_property(@default, "score", float)
      insert().into(@default).nodes([{_id:"A"},{_id:"B"},{_id:"C"},{_id:"D"},{_id:"E"},{_id:"F"},{_id:"G"},{_id:"H"},{_id:"I"},{_id:"J"},{_id:"K"}])
      insert().into(@default).edges([{_from:"A", _to:"B", score:1}, {_from:"A", _to:"C", score:3}, {_from:"C", _to:"D", score:1.5}, {_from:"D", _to:"C", score:2.4}, {_from:"D", _to:"F", score:5}, {_from:"E", _to:"C", score:2.2}, {_from:"E", _to:"F", score:0.6}, {_from:"F", _to:"G", score:1.5}, {_from:"G", _to:"J", score:2}, {_from:"H", _to:"G", score:2.5}, {_from:"H", _to:"I", score:1}, {_from:"I", _to:"I", score:3.1}, {_from:"J", _to:"G", score:2.6}])
      

      创建HDC图集

      将当前图集全部加载到HDC服务器hdc-server-1上,并命名为 hdc_node2vec_walk

      CALL hdc.graph.create("hdc-server-1", "hdc_node2vec_walk", {
        nodes: {"*": ["*"]},
        edges: {"*": ["*"]},
        direction: "undirected",
        load_id: true,
        update: "static",
        query: "query",
        default: false
      })
      

      hdc.graph.create("hdc_node2vec_walk", {
        nodes: {"*": ["*"]},
        edges: {"*": ["*"]},
        direction: "undirected",
        load_id: true,
        update: "static",
        query: "query",
        default: false
      }).to("hdc-server-1")
      

      参数

      算法名:random_walk_node2vec

      参数名
      类型
      规范
      默认值
      可选
      描述
      ids []_id / / 通过_id指定随机游走的起点;若未设置则计算所有点
      uuids []_uuid / / 通过_uuid指定随机游走的起点;若未设置则计算所有点
      walk_length Integer ≥1 1 每次游走的深度,即访问的节点数量
      walk_num Integer ≥1 1 从每个指定节点开始的游走次数
      p Float >0 1 返回参数;数值越大,回走概率越小
      q Float >0 1 远近参数;数值大于1时,倾向于在同级游走,否则倾向于向远处游走
      edge_schema_property []"<@schema.?><property>" / / 作为权重的数值类型边属性,权重值为所有指定属性值的总和;不包含指定属性的边将被忽略
      return_id_uuid String uuid, id, both uuid 在结果中使用_uuid_id或同时使用两者来表示点
      limit Integer ≥-1 -1 限制返回的结果数;-1返回所有结果

      文件回写

      CALL algo.random_walk_node2vec.write("hdc_node2vec_walk", {
        params: {
          return_id_uuid: "id",
          walk_length: 6,
          walk_num: 2,
          p: 10000, 
          q: 0.0001
        },
        return_params: {
          file: {
            filename: "walks"
          }
        }
      })
      

      algo(random_walk_node2vec).params({
        project: "hdc_node2vec_walk",
        return_id_uuid: "id",
        walk_length: 6,
        walk_num: 2,
        p: 10000, 
        q: 0.0001
      }).write({
        file:{
          filename: 'walks'
      }})
      

      结果:

      _ids
      J,G,F,D,C,E,
      D,C,A,B,A,C,
      F,G,E,C,A,B,
      H,I,I,H,G,F,
      B,A,C,D,F,G,
      A,B,A,B,A,C,
      E,C,E,C,A,B,
      K,
      C,E,F,G,J,G,
      I,I,H,G,F,E,
      G,H,I,I,H,G,
      J,G,F,D,C,E,
      D,C,A,B,A,C,
      F,E,C,D,F,E,
      H,G,H,G,J,G,
      B,A,C,D,F,G,
      A,C,D,F,E,C,
      E,C,E,C,A,B,
      K,
      C,A,B,A,C,D,
      I,H,G,J,G,H,
      G,H,I,I,H,G,
      

      完整返回

      CALL algo.random_walk_node2vec("hdc_node2vec_walk", {
        params: {
          return_id_uuid: "id",
          ids: ['J'],
          walk_length: 6,
          walk_num: 3,
          p: 2000,
          q: 0.001
        },
        return_params: {}
      }) YIELD walks
      RETURN walks
      

      exec{
        algo(random_walk_node2vec).params({
          return_id_uuid: "id",
          ids: ['J'],
          walk_length: 6,
          walk_num: 3,
          p: 2000,
          q: 0.001
        }) as walks
        return walks
      } on hdc_node2vec_walk
      

      结果:

      _ids
      ["J","G","F","D","C","E"]
      ["J","G","J","G","F","D"]
      ["J","G","J","G","H","I"]

      流式返回

      CALL algo.random_walk_node2vec("hdc_node2vec_walk", {
        params: {
          return_id_uuid: "id",
          ids: ['A'],
          walk_length: 5,
          walk_num: 10,
          p: 1000,
          q: 1,
          edge_schema_property: 'score'
        },
        return_params: {
          stream: {}
        }
      }) YIELD walks
      RETURN walks
      

      exec{
        algo(random_walk_node2vec).params({
          return_id_uuid: "id",
          ids: ['A'],
          walk_length: 5,
          walk_num: 10,
          p: 1000,
          q: 1,
          edge_schema_property: 'score'
        }).stream() as walks
        return walks
      } on hdc_node2vec_walk
      

      结果:

      _ids
      ["A","C","A","D","C"]
      ["A","C","A","C","A"]
      ["A","C","A","D","A"]
      ["A","C","A","C","A"]
      ["A","C","A","D","E"]
      ["A","C","A","D","E"]
      ["A","C","A","B","A"]
      ["A","C","A","D","A"]
      ["A","C","A","C","D"]
      ["A","C","A","C","A"]
      请完成以下信息后可下载此书
      *
      公司名称不能为空
      *
      公司邮箱必须填写
      *
      你的名字必须填写
      *
      你的电话必须填写
      *
      你的电话必须填写