Bug introduced in 10.2 and fixed in 11.0.1
Firstly we get these idiom
web = Import["http://chengyu.t086.com/jielong/zuichang.html"];
idiom = StringCases[web,
RegularExpression[
"(?<=\\s\\-\\>\\s)[一-龥]{4}|[一-龥]{4}(?=\\s\\-\\>\\s)"]];
Then he use the RelationGraph
to draw graph.
g = RelationGraph[StringTake[#1, -1] == StringTake[#2, 1] &,
idiom[[;; 1664]]]
We can get
Actually the idiom
have more element.
idiom // Length
1792
But If I want to get more long graph upto 1665
g = RelationGraph[StringTake[#1, -1] == StringTake[#2, 1] &,
idiom[[;; 1665]]]
We'll get a unexpected graph or a error information,But I cannot find any bad stuff surround 1655
Take[idiom, {1663, 1667}]
{依依不舍,舍己为人,轻而易举,举一反三,三生有幸}
Is it a bug of RelationGraph
or have I missed something?
Answer
There is a duplicated vertex causing this issue:
idiom[[;; 1665]] // Length
1665
idiom[[;; 1665]] // Union // Length
1664
As a workaround, you could take Union over the vertex set:
g = RelationGraph[StringTake[#1, -1] == StringTake[#2, 1] &,
Union@idiom[[;; 1665]]];
GraphQ[g]
True
but the output shouldn't be that.
You should report this to Wolfram support.
Comments
Post a Comment