2014-09-21 17 views
1

工作不考慮GraphML這個簡單的,二分圖:二分(雙模式)圖形的簡單的投影中的igraph 0.7.1

<?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版本complains

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

這可能是一個錯誤的igraph,但似乎忽略了type屬性的默認值:

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

的解決方法是顯式指定它,直到錯誤是固定的。

+2

我剛剛創建的相關錯誤報告:https://github.com/igraph/igraph/issues/684 – 2014-09-22 20:13:52