# Getting error from CommunityGraphPlot

### Situation

I'd like analyse my web site with CommunityGraphPlot as follows:

Step 1: Define a function to scrape the all the webpages from expected website.

netScrape[url_] :=


Step 2: Define a function to crawl the topology, down to the depth I want to dig.

webCrawler[rootUrl_, depth_] :=
Flatten[Rest[NestList[netScrape, {"" -> rootUrl}, depth]]]


Step 3: crawl the website.

netFriends = webCrawler["http://bitwan.science", 2]


Step 4: Plot the community.

CommunityGraphPlot[netFriends]


### Debug

I ran the above code, step1 through step4. However, I get a warning saying

A graph object is expected at position 1 in EdgeList ...

Checking the data type of netFriends with netFriends // FullForm, confirms it is a list of rules.

I refer to Mathematica documentation on CommunityGraphPlot. I find it says that it's legal when using

CommunityGraphPlot[{v1 -> v2, v3 -> v4}, ... ]


### My Question

I am confused by this situation. As the netFriends is a list of rules, why doesn't CommunityGraphPlot[netFriends] work?

Can anyone tell me why my codes produced the error I am seeing?

• Can you share the contents of the file "friends.txt"? Or at least an representative example of its form? – rhermans Nov 13 '15 at 10:03
• hello @rhermans , I have upload the data set. – PureLine Nov 13 '15 at 10:09
• Thanks, BTW ?dl=1 in the Dropbox URL for automatic download. I edited it for you. Please keep that file there forever, as this question will be visited by other users in the future. – rhermans Nov 13 '15 at 10:13
• StringQ@friends give True. You have imported the data as a single String, not a table of rules. – rhermans Nov 13 '15 at 10:19
• Your question may be put on-hold as it seems to be off-topic, i.e it arises from a simple mistake (syntax error, incorrect capitalization, spelling mistake) and is unlikely to help any future visitors, or else it is easily found in the documentation. Don't be discouraged by that cleaning-up policy. Your future good questions are welcome. Learn about common pitfalls here. – rhermans Nov 13 '15 at 10:28

The problem in your code is that you have imported the data as a single String, not as table of rules as you expected. See that by evaluating StringQ[friends].
friends = Import[