New in Wolfram
Mathematica
8: Graph & Network Modeling
◄
previous
|
next
►
Application Areas
Structure of the Web
A network of pages on a corporate website.
In[1]:=
X
webcrawler[rooturl_, depth_] := Flatten[ Rest[NestList[ Union[Flatten[ Thread[# -> Import[#, "Hyperlinks"]] & /@ Last /@ #]] &, {"" -> rooturl}, depth]]];
In[2]:=
X
style = {VertexStyle -> White, VertexShapeFunction -> "Point", EdgeStyle -> Directive[Opacity[.5], Hue[.15, .5, .8]], Background -> Black, EdgeShapeFunction -> (Line[#1] &), ImageSize -> 500};
In[3]:=
X
Graph[webcrawler["http://www.wolfram.com", 2], style]
Out[3]=