如何使用graphml格式表示可迭代的属性 [英] How to represent an iterable attribute using graphml format

查看:197
本文介绍了如何使用graphml格式表示可迭代的属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个图形示例,该图形的图形属性名为random,其值为23.有没有一种方法可以在不违反核心格式的情况下以这种格式将值列表表示为图形属性?

I have an example of a graph with a graph property named random that has a value of 23. Is there a way to represent say a list of values as a graph attribute in this format without violating the core format?

<?xml version="1.0" encoding="UTF-8"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns
    http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">

  <key id="g_random" for="graph" attr.name="random" attr.type="double"/>
  <graph id="G" edgedefault="undirected">
    <data key="g_random">23</data> 
    <node id="n0">
    </node>
    <node id="n1">
    </node>
    <edge source="n0" target="n1">
    </edge>
 </graph>

谢谢

推荐答案

我最终使用了string数据类型对数组中的数据进行编码. 没有原生方式在发布时使用这种格式表示可迭代的数据类型.这是一个node属性的示例,该属性带有与其关联的值的数组,格式为graphml:

I ended up using a string data type to encode the data within the array. There is no native way to represent iterable data types with this format at the time of this posting. Here is an example of a node attribute with an array of values associated with it, in graphml format:

<graphml 
<!-- Boilerplate graphml -->

<key id="v_arr" for="node" attr.name="arr" attr.type="string"/>
<graph id="G" edgedefault="undirected">
:
:

<node id="n0">
  <data key="v_arr">23 4 5</data>
</node>
<node id="n1">
  <data key="v_arr">34.3 53.34</data>
</node>
<node id="n2">
  <data key="v_arr">45.4 23E-23</data>
</node>
<edge source="n0" target="n2">
</edge>

这篇关于如何使用graphml格式表示可迭代的属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆