I have the data for graph nodes as:
graphComponents = {{"blood", "pressur"}, {"harvard", "oxford"}, {"help", "lower"},
{"oxford", "benefit"}, {"harvard", "benefit"}, {"lower", "level"}, {"faceoff", "benefit"}
, {"oxford", "faceoff"}, {"harvard", "faceoff"}, {"over", "benefit"}, {"faceoff", "over"},
{"oxford", "over"}, {"harvard", "over"}, {"benefit", "drug"},
{"oxford", "drug"}, {"harvard", "drug"}, {"faceoff", "drug"}, {"fast", "test"},
{"over", "drug"}, {"test", "test2"}};
Then I want to make a Manipulate
to show the communities of the graph:
Manipulate[
components = graphComponents[[1 ;; L]];
rawGraph = Graph[#[[1]] <-> #[[2]] & /@ graphComponents[[1 ;; L]]];
communities = FindGraphCommunities[rawGraph];
H = HighlightGraph[rawGraph, Subgraph[rawGraph, communities[[i]]]],
{{L, 15, "Number of Tuples: "}, 5, 20, 5},
{{i, 2, "Cluster number: "}, 1, 3, 1},
LocalizeVariables -> False]
The question is as the value of L
changes the number of communities change as well. So the control list for variable i
should be updated when L
changes. How should this be done?
graphComponents
can be reduced to a few words. $\endgroup$