I've been playing around with Mathematica's visualization and webcrawling capabilities. Building on some demonstration code, I'm able to visualize the a network. Here's an example on a university webpage:
webcrawler[rooturl_, depth_] :=
Flatten[Rest[NestList[
Union[Flatten[Thread[# -> Import[#,"Hyperlinks"]] & /@ Last /@ #]] &,
{"" -> rooturl}, depth]]];
Graph[webcrawler[
"http://www.yorku.ca/", 2], {ImageSize -> Full}]
However, I've been trying fruitlessly to figure out a way to apply EdgeLabels[] to this Graph[]
command. I would like to have each link written on each line, just to give a sense of what exactly the link clusters represent.
I've tried applying a generated list of the Hyperlink connections to it, which didn't work, and neither did any of the readily obvious commands from documentation/elsewhere on stack/the cookbook.
I envision a very cluttered output.
I don't know in case of a large graph how will the edge label look. But here how it can be done in Mathematica 8.
webcrawler[rooturl_, depth_] :=
Flatten[Rest[
NestList[
Union[Flatten[
Thread[# -> Import[#, "Hyperlinks"]] & /@
Last /@ #]] &, {"" -> rooturl}, depth]]];
dats = webcrawler["http://www.uni-kl.de/", 2];
Graph[dats ,EdgeLabels ->Table[dats[[i]] -> dats[[i]][[2]],
{i,Length[dats]}], {ImageSize -> Full}]
I hope this helps.
BR
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With