0
$\begingroup$

I'm currently working on some graph theory, and I'm checking the robustness of graphs, by removing random vertices from a graph and then check how many vertices are outside the giant component. Then I'll do that for a lot of vertices, and plot them using ListPlot.

This takes along time to calculate, is there a way I can visualise it, that it plots something everytime a value is calculated.

thisFunctionTakesVeryLongAndReturnsAList := .... ListPlot[thisFunctionTakesVeryLongAndReturnsAList [graph]] 

thisFunctionTakesVeryLongAndReturnsAList calculates a value that can be plotted all the time

1 Answers 1

1

Timo,

If you have Mathematica 6 or later, you can use Dynamic for this. You should rewrite your thisFunctionTakesVeryLongAndReturnsAList like this:

list = {}; calculateOnePointVeryLong[x_] := (Pause[1]; result = {x, x^2};     AppendTo[list, result]; result); Graphics[Point[Dynamic[list]], Axes -> True,   AspectRatio -> 1/GoldenRatio] makeList = Table[calculateOnePointVeryLong[x], {x, 0, 10}]; 
  • 0
    $A$wesome, thanks I'll check into this :)2011-03-20