/ / igraph 0.7.1で動作しない2部(2モード)グラフの単純な投影-xml、igraph、graphml

igraph 0.7.1 - xml、igraph、graphmlで動作しないbipartite(two-mode)グラフの簡単な投影

GraphMLのこの単純な2部グラフを考えてみましょう。

<?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="type" for="node" attr.name="type" attr.type="boolean">
<default>TRUE</default>
</key>
<graph id="G" edgedefault="directed">
<node id="p1"><data key="type">FALSE</data></node>
<node id="o1"></node>
<node id="o2"></node>
<edge id="e1" source="p1" target="o1"></edge>
<edge id="e2" source="p1" target="o2"></edge>
</graph>
</graphml>

次に、このRセッションを検討します。

require("igraph")
graph <- read.graph(file="bipartitetest.graphml",format="graphml")
proj <- bipartite.projection(graph)

グラフオブジェクトは正常に見えますが:

graph
IGRAPH D--B 3 2 --
+ attr: type (v/l), id (v/c), id (e/c)

私のigraphバージョン0.7.1 文句を言う

Error in .Call("R_igraph_bipartite_projection", graph, types, as.integer(probe1),  :
At bipartite.c:198 : Non-bipartite edge found in bipartite projection, Invalid value

何故ですか?単純なグラフは、アプリオリに有効であるようです。

回答:

回答№1は1

これはおそらくigraphのバグですが、一見するとデフォルト値の無視されます type 属性:

V(graph)$type
# [1] FALSE FALSE FALSE

回避策は、バグが修正されるまで明示的に指定することです。