In this answer, @Vitaliy Kaurov explores and utilizes new Mathematica's functionality WolframLanguageData:

graphicssym = 
    "WolframLanguageSymbol", {"FunctionalityArea", "GraphicsFunctions"}]];

linktrails = 
  EntityValue[graphicssym, EntityProperty["WolframLanguageSymbol", "LinkTrails"]];

edges = 
  Flatten[(DirectedEdge @@@ Partition[#, 2, 1]) & /@ 
     Select[Flatten[linktrails, 1], Length[#] > 1 &]];

verts = Flatten[List @@@ edges] // Union;

  VertexLabels -> Placed["Name", Tooltip], 
  VertexStyle -> ((# -> If[StringMatchQ[#, "*ref/*"], Red, Green]) & /@ verts)]

enter image description here

As you can see, there two types of nodes: "green" for guides, and "red" for reference pages. This covers of course only a small subset of Mathematica documentation, since "FunctionalityArea" is limited to "GraphicsFunctions". But this is convenient for visual exploration, certainly much better than a graph with hundreds of thousands nodes, so I like this as a test example.

I would like to do some visualization of Mathematica's documentation structure with external tools. In order to do this, I want to obtain information presented in the graph above inside a JSON file with the following format:

  • "groups" are simply two types of pages of Mathematica documentation, "guide", and "ref";
  • "nodes" is a list of nodes that contain the node name and index of the node's group;
  • "links" is a list of links between nodes, and nodes are determined by their indexes in their list.

I tried to incorporate @Szabolcs 's code from another answer into my solution:

g = RandomGraph[BarabasiAlbertGraphDistribution[100, 1]]

names = VertexList[g];
groups = VertexDegree[g]; (* let's try degree-based colouring *)

    "nodes" -> MapThread[{"name" -> #1, "group" -> #2} &, {names, groups}],
    "links" -> 
       ({"source" -> #1 - 1, "target" -> #2 - 1, "value" -> 1} &) @@@ EdgeList[g]

However, I couldn't get all bits and pieces working. Hope some of you could help.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.