Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

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}];
share|improve this answer
    
Awesome, thanks I'll check into this :) –  Timo Willemsen Mar 20 '11 at 13:21
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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