14
$\begingroup$

Bug introduced in 9.0 or earlier and fixed in 12.0


Test the below function:

Func[g_] := 
Module[{G, vl, vdG},    
G = g;    
While[VertexCount[G] != 0,  
vl = VertexList[G];  
vdG = Map[VertexDegree[G, #] &, vl];     
vl = Extract[vl, Position[vdG, Max[vdG]]];     
G = VertexDelete[G, vl[[1]]];
];
Return[True];    
]

with

While[g = RandomGraph[
   BernoulliGraphDistribution[ RandomInteger[{50, 100}], 
    RandomReal[]]]; Func[g]; True]

The same if Module[{G=g,...

Good if G = Graph[VertexList[g], EdgeList[g]];

Is there any method to copy a graph efficiently?

$\endgroup$
5
  • $\begingroup$ You can format inline code and code blocks by selecting the code and clicking the {} button above the edit window. The edit window help button ? is also useful for learning how to format your questions and answers. You may also find this meta Q&A helpful $\endgroup$
    – Michael E2
    Sep 3, 2016 at 0:34
  • $\begingroup$ I tried to edit the code to make a little more sense. Please role back either Micheal or ZYX if you don't approve. $\endgroup$
    – William
    Sep 3, 2016 at 0:50
  • 2
    $\begingroup$ Confirmed. Please report bugs to Wolfram Support. $\endgroup$
    – Szabolcs
    Sep 3, 2016 at 10:12
  • $\begingroup$ @Szabolcs 11.2 is out ?! $\endgroup$
    – gwr
    Sep 15, 2017 at 9:44
  • $\begingroup$ @gwr blog.wolfram.com/2017/09/14/… $\endgroup$
    – Szabolcs
    Sep 15, 2017 at 9:46

1 Answer 1

10
$\begingroup$

I can reproduce the problem. A more minimal example is

Dynamic@N[a/1024^2]

While[True,
 VertexDelete[RandomGraph[BernoulliGraphDistribution[50, 0.5]], 1];
 a = MemoryInUse[];
]

Please report this to Wolfram Support.

$\endgroup$

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.