I always wonder how many inbuilt functions does Mathematica have (of course you can google for it) and how they are connected with each other! So I tried this (v10.1).

comms = FileNames[];
ncomms = Length[comms]


I believe this is the total number of documented functions. Now the second part where I am stuck in. How to find the connections among them?

What I am thinking is to get the list of functions from the See Also section of an example. Here I do one manually. Let's say I start with Plot. See Also in Plot.nb contains ({DiscretePlot, ListLinePlot, ParametricPlot, PolarPlot, Plot3D, ContourPlot, Graphics, Show}). So I store them.

link["Plot"] = {"DiscretePlot", "ListLinePlot", "ParametricPlot" , 
                "PolarPlot", "Plot3D", "ContourPlot", "Graphics", "Show"};

Now I want to scan each element of the list. For example, I take Plot3D and Graphics

link["Plot3D"] = {"ListPlot3D", "ContourPlot", "DensityPlot", "ParametricPlot3D",
                  "Graphics3D", "ListSurfacePlot3D", "Plot", "Show"};

link["Graphics"] = {"Plot", "ListPlot", "ListLinePlot", "ParametricPlot", "DensityPlot",
                    "ArrayPlot", "RegionPlot", "ContourPlot", "Show", "Graphics3D",
                    "Image", "Import", "Sound"};

Now combine and map them

map = Join[DirectedEdge[num["Plot"], num[#]] & /@ link["Plot"],
           DirectedEdge[num["Plot3D"], num[#]] & /@ link["Plot3D"],
           DirectedEdge[num["Graphics"], num[#]] & /@ link["Graphics"]];

Graph[map, VertexLabels -> Table[n -> sets[[n]], {n, nsets}], ImagePadding -> 10]

enter image description here

How can I put this whole thing in a Mathematica code?

  • 3
    $\begingroup$ You can start with: WolframLanguageData["Plot", "RelationshipCommunityGraph"] $\endgroup$
    – Kuba
    Commented Aug 10, 2016 at 11:56
  • $\begingroup$ closely related: How to get complete Documentation Center graph of guide pages? $\endgroup$
    – Kuba
    Commented Aug 10, 2016 at 12:08
  • $\begingroup$ thanks @Kuba, didn't know about WolframLanguageData. I like Leonid's answer because it will work for the older version as well. $\endgroup$
    – Sumit
    Commented Aug 10, 2016 at 12:55

3 Answers 3

(* docs on my system (10.3, Windows) *)
base = FileNameJoin[{$InstallationDirectory, "Documentation",
    "English", "System", "ReferencePages", "Symbols"}];

FileNames[FileNameJoin[{base, "*"}]] // Length


(* symbols in See Also section *)
also[name_String] :=
  import = Import[
    FileNameJoin[{base, name <> ".nb"}], {"Cells", "SeeAlso"}];
  Cases[import, TextData[s_String] :> s, Infinity]]


{"Complex", "Re", "Im", "ComplexExpand", "GaussianIntegers"}

edges[start_String, n_Integer] :=
 Reap[Module[{visited = {}},
        temp = Join @@ Table[
           Sow[DirectedEdge[v, #] & /@ also[v]], {v, visiting}];
        visited = Join[visited, visiting];
        Complement[Last /@ temp, visited]]],
      {start}, n]]][[2, 1]] // Flatten

graph[edges : {__DirectedEdge}, start_String, opts___] :=
 Graph[edges, opts,
  VertexLabels -> "Name",
  VertexStyle -> {start -> Red}]

Example 1

With[{x = "I"}, graph[edges[x, 2], x]]

enter image description here

Example 2

(* this took me 40 seconds *)
e5 = edges["Plot", 5];

g = graph[e5, "Plot",
  VertexLabels -> None,
  EdgeStyle -> Directive[Opacity[.2]],
  EdgeShapeFunction -> ({Arrowheads[.01], Arrow[#]} &)];

Through[{VertexCount, EdgeCount}@g]

{1463, 4192}

Majority of vertices are not reachable from a general source (dark red area). Note that: a) graph is directed, and b) crawler stopped after five steps.

dm = GraphDistanceMatrix[g];
dm // MatrixPlot

enter image description here

max = Max[dm /. Infinity -> 0]


pos = Position[dm, max];
pairs = VertexList[g][[#]] & /@ pos;

Example of a longest shortest path (via pairs). Starting in Help with Repeated, 13 clicks are needed at least to get to Arrow.

sp = FindShortestPath[g, "Repeated", "Arrow"];
(* {"Repeated", "BlankSequence", ... "Arrow"} *)

HighlightGraph[g, PathGraph[sp, DirectedEdges -> True]]

enter image description here

  • $\begingroup$ This method is awesome! In lots of aspects it's better than mine! would you mind me to edit my answer a bit to include some awesome part of your answer? (like Import stuff) $\endgroup$
    – Wjx
    Commented Aug 10, 2016 at 15:31
  • $\begingroup$ Also, this method has one small drawback in the crawler part: you actually can store something to aviod repetitive calculation and import. This may speed things up a lot I suppose? :) $\endgroup$
    – Wjx
    Commented Aug 10, 2016 at 15:36
  • $\begingroup$ @Wjx No, I wouldn't mind, and yes, I've been thinking about the crawler ... will update. $\endgroup$
    – BoLe
    Commented Aug 10, 2016 at 17:35
  • $\begingroup$ However, result for cosine is nothing like WolframLanguageData example. $\endgroup$
    – BoLe
    Commented Aug 10, 2016 at 18:00
  • $\begingroup$ I've consolidated the code and added an example. $\endgroup$
    – BoLe
    Commented Aug 11, 2016 at 8:33

There is a way for you to find out the relations without internet, and I think it fit your need more as they are actually extracted directly from those "See Also" links.

I'm currently using v11, 5000+ Functions, it takes about 7 min before it finishes the main evaluation, and another 10 min or so for plotting the community graph out, but it's totally internet free, thus can be a bit more helpful when under bad net conditions.

dir = FileNameJoin[{$InstallationDirectory, 
files = Import[dir];

rules = Flatten[Function[{name}, Thread[StringSplit[name, "."][[1]] -> 
   Block[{f = Import[FileNameJoin[{dir, name}]], p}, 
    p = Position[f, "See Also"]; 
     If[p != {}, Cases[#, TextData[s_String]:>s] &@
      Extract[f, Drop[p[[-1]], -5]], {}]]]] /@ files];


This method follows how we humans know about the links between functions-----via checking the "See Also" part of the documentation of course. So we can extract those part out one by one, make rules out of them, then use Graph and CommunityGraphPlot to visualize them.

The result is stylish(If we view in the Abstract Painting's style :P) and the structure is clear(Though a bit messy): Mathematica's core functions are closely related!!!


community graph

  • $\begingroup$ Thanks @Wjx, I am indeed looking for a method which does not involve the internet. I added that to the title. $\endgroup$
    – Sumit
    Commented Aug 10, 2016 at 13:55
  • $\begingroup$ So will this be what you need? @Sumit :) $\endgroup$
    – Wjx
    Commented Aug 10, 2016 at 14:10
  • $\begingroup$ yup. I will accept it few hours later - just in case someone has some other thoughts ;) $\endgroup$
    – Sumit
    Commented Aug 10, 2016 at 14:57
  • $\begingroup$ I was wondering whether the complete relationship was connected, as in a single component graph ... Did you identify some of the symbols in other components? $\endgroup$
    – BoLe
    Commented Aug 10, 2016 at 15:00
  • $\begingroup$ ImageIdentify thinks that these graphs are a virus and a bobby pin, respectively. $\endgroup$
    – Karsten7
    Commented Aug 10, 2016 at 18:12

Something like this:

g = SimpleGraph@Graph[
     Thread /@ 
        WolframLanguageData[WolframLanguageData[], "RelatedSymbols", "EntityAssociation"]
    DirectedEdges -> False

It's slow, like most new *Data functions, but it works.

  • 1
    $\begingroup$ You can get a bunch of smaller graphs that show some connections with WolframLanguageData[All, "RelationshipGraph"] -- so not exactly what the OP asked for but interesting visualisations anyway. It doesn't have all the functions (WLD[f, "RelationshipGraph"] doesn't show f in its graph). Makes for a nice puzzle, as well... $\endgroup$
    – Gerli
    Commented Aug 11, 2016 at 8:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.